Skip to content

Commit

Permalink
fix conditional compilation for netcoreapp1.0 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Jul 30, 2016
1 parent 3fc8c8a commit 1c0f30c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Grpc.Core.Tests
{
public class AppDomainUnloadTest
{
#if NETSTANDARD1_5
#if NETCOREAPP1_0
[Test]
[Ignore("Not supported for CoreCLR")]
public void AppDomainUnloadHookCanCleanupAbandonedCall()
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.Core.Tests/NUnitMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static int Main(string[] args)
{
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
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);
#else
return new AutoRun().Execute(args);
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.Core.Tests/SanityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Grpc.Core.Tests
public class SanityTest
{
// TODO: make sanity test work for CoreCLR as well
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
/// <summary>
/// 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,
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.Examples.Tests/NUnitMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static int Main(string[] args)
{
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
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);
#else
return new AutoRun().Execute(args);
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.HealthCheck.Tests/NUnitMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static int Main(string[] args)
{
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
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);
#else
return new AutoRun().Execute(args);
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class GeneratedClientTest
TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient();

// TODO: replace Moq by some mocking library with CoreCLR support.
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
[Test]
public void ExpandedParamOverloadCanBeMocked()
{
Expand Down
10 changes: 5 additions & 5 deletions src/csharp/Grpc.IntegrationTesting/InteropClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private async Task<ChannelCredentials> CreateCredentialsAsync()

if (options.TestCase == "jwt_token_creds")
{
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsTrue(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
Expand All @@ -157,7 +157,7 @@ private async Task<ChannelCredentials> CreateCredentialsAsync()

if (options.TestCase == "compute_engine_creds")
{
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync();
Assert.IsFalse(googleCredential.IsCreateScopedRequired);
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials());
Expand Down Expand Up @@ -395,7 +395,7 @@ public static void RunJwtTokenCreds(TestService.TestServiceClient client)

public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope)
{
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
Console.WriteLine("running oauth2_auth_token");
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope });
string oauth2Token = await credential.GetAccessTokenForRequestAsync();
Expand All @@ -421,7 +421,7 @@ public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient c

public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope)
{
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
Console.WriteLine("running per_rpc_creds");
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync();

Expand Down Expand Up @@ -731,7 +731,7 @@ private static Metadata CreateClientCompressionMetadata(bool compressed)
// extracts the client_email field from service account file used for auth test cases
private static string GetEmailFromServiceAccountFile()
{
#if !NETSTANDARD1_5
#if !NETCOREAPP1_0
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
Assert.IsNotNull(keyFile);
var jobject = JObject.Parse(File.ReadAllText(keyFile));
Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.IntegrationTesting/NUnitMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static int Main(string[] args)
{
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406.
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);
#else
return new AutoRun().Execute(args);
Expand Down

0 comments on commit 1c0f30c

Please sign in to comment.