Skip to content
Snippets Groups Projects
Commit 1c0f30c4 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

fix conditional compilation for netcoreapp1.0 projects

parent 3fc8c8a9
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ namespace Grpc.Core.Tests ...@@ -40,7 +40,7 @@ namespace Grpc.Core.Tests
{ {
public class AppDomainUnloadTest public class AppDomainUnloadTest
{ {
#if NETSTANDARD1_5 #if NETCOREAPP1_0
[Test] [Test]
[Ignore("Not supported for CoreCLR")] [Ignore("Not supported for CoreCLR")]
public void AppDomainUnloadHookCanCleanupAbandonedCall() public void AppDomainUnloadHookCanCleanupAbandonedCall()
......
...@@ -49,7 +49,7 @@ namespace Grpc.Core.Tests ...@@ -49,7 +49,7 @@ namespace Grpc.Core.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);
......
...@@ -46,7 +46,7 @@ namespace Grpc.Core.Tests ...@@ -46,7 +46,7 @@ namespace Grpc.Core.Tests
public class SanityTest public class SanityTest
{ {
// TODO: make sanity test work for CoreCLR as well // TODO: make sanity test work for CoreCLR as well
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
/// <summary> /// <summary>
/// Because we depend on a native library, sometimes when things go wrong, the /// Because we depend on a native library, sometimes when things go wrong, the
/// entire NUnit test process crashes. To be able to track down problems better, /// entire NUnit test process crashes. To be able to track down problems better,
......
...@@ -49,7 +49,7 @@ namespace Grpc.Examples.Tests ...@@ -49,7 +49,7 @@ namespace Grpc.Examples.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);
......
...@@ -49,7 +49,7 @@ namespace Grpc.HealthCheck.Tests ...@@ -49,7 +49,7 @@ namespace Grpc.HealthCheck.Tests
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);
......
...@@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting ...@@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting
TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient(); TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient();
// TODO: replace Moq by some mocking library with CoreCLR support. // TODO: replace Moq by some mocking library with CoreCLR support.
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
[Test] [Test]
public void ExpandedParamOverloadCanBeMocked() public void ExpandedParamOverloadCanBeMocked()
{ {
......
...@@ -145,7 +145,7 @@ namespace Grpc.IntegrationTesting ...@@ -145,7 +145,7 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "jwt_token_creds") if (options.TestCase == "jwt_token_creds")
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsTrue(googleCredential.IsCreateScopedRequired); Assert.IsTrue(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
...@@ -157,7 +157,7 @@ namespace Grpc.IntegrationTesting ...@@ -157,7 +157,7 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "compute_engine_creds") if (options.TestCase == "compute_engine_creds")
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsFalse(googleCredential.IsCreateScopedRequired); Assert.IsFalse(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
...@@ -395,7 +395,7 @@ namespace Grpc.IntegrationTesting ...@@ -395,7 +395,7 @@ namespace Grpc.IntegrationTesting
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
Console.WriteLine("running oauth2_auth_token"); Console.WriteLine("running oauth2_auth_token");
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope });
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); string oauth2Token = await credential.GetAccessTokenForRequestAsync();
...@@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting ...@@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
Console.WriteLine("running per_rpc_creds"); Console.WriteLine("running per_rpc_creds");
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
...@@ -731,7 +731,7 @@ namespace Grpc.IntegrationTesting ...@@ -731,7 +731,7 @@ namespace Grpc.IntegrationTesting
// extracts the client_email field from service account file used for auth test cases // extracts the client_email field from service account file used for auth test cases
private static string GetEmailFromServiceAccountFile() private static string GetEmailFromServiceAccountFile()
{ {
#if !NETSTANDARD1_5 #if !NETCOREAPP1_0
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
Assert.IsNotNull(keyFile); Assert.IsNotNull(keyFile);
var jobject = JObject.Parse(File.ReadAllText(keyFile)); var jobject = JObject.Parse(File.ReadAllText(keyFile));
......
...@@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting ...@@ -49,7 +49,7 @@ namespace Grpc.IntegrationTesting
{ {
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. // Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error));
#if NETSTANDARD1_5 #if NETCOREAPP1_0
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
#else #else
return new AutoRun().Execute(args); return new AutoRun().Execute(args);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment