From b323608b2717ed617edcebfca9ffb1249045e141 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 8 Apr 2016 17:08:57 -0700 Subject: fix test credentials for nunit3 --- .../Grpc.IntegrationTesting/TestCredentials.cs | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/csharp/Grpc.IntegrationTesting/TestCredentials.cs') diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs index ce108d808b..aa54cd38a1 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs @@ -50,9 +50,29 @@ namespace Grpc.IntegrationTesting { public const string DefaultHostOverride = "foo.test.google.fr"; - public const string ClientCertAuthorityPath = "data/ca.pem"; - public const string ServerCertChainPath = "data/server1.pem"; - public const string ServerPrivateKeyPath = "data/server1.key"; + public static string ClientCertAuthorityPath + { + get + { + return GetPath("data/ca.pem"); + } + } + + public static string ServerCertChainPath + { + get + { + return GetPath("data/server1.pem"); + } + } + + public static string ServerPrivateKeyPath + { + get + { + return GetPath("data/server1.key"); + } + } public static SslCredentials CreateSslCredentials() { @@ -66,5 +86,10 @@ namespace Grpc.IntegrationTesting File.ReadAllText(ServerPrivateKeyPath)); return new SslServerCredentials(new[] { keyCertPair }); } + + private static string GetPath(string relativePath) + { + return Path.Combine(TestContext.CurrentContext.TestDirectory, relativePath); + } } } -- cgit v1.2.3 From 10e85f1ef7c0f6df55eaa4eee6804c9f0ec3d5eb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sat, 9 Apr 2016 13:16:37 -0700 Subject: fix interop tests --- src/csharp/Grpc.IntegrationTesting/TestCredentials.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/csharp/Grpc.IntegrationTesting/TestCredentials.cs') diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs index aa54cd38a1..774563d752 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs @@ -35,6 +35,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Reflection; using System.Text.RegularExpressions; using System.Threading.Tasks; using Grpc.Core; @@ -89,7 +90,8 @@ namespace Grpc.IntegrationTesting private static string GetPath(string relativePath) { - return Path.Combine(TestContext.CurrentContext.TestDirectory, relativePath); + var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + return Path.Combine(assemblyDir, relativePath); } } } -- cgit v1.2.3