aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.IntegrationTesting/TestCredentials.cs')
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestCredentials.cs33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
index ce108d808b..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;
@@ -50,9 +51,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 +87,11 @@ namespace Grpc.IntegrationTesting
File.ReadAllText(ServerPrivateKeyPath));
return new SslServerCredentials(new[] { keyCertPair });
}
+
+ private static string GetPath(string relativePath)
+ {
+ var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ return Path.Combine(assemblyDir, relativePath);
+ }
}
}