aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Examples.Tests
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-04 22:02:55 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-04 22:02:55 -0700
commit31ba0632247993b02b552294691a354ee5d0ef08 (patch)
tree47063b83bf3d9fcf04ee66a87afe3198a16de378 /src/csharp/Grpc.Examples.Tests
parent021df8a7f23c00216d1a544b34d4da2222054f0a (diff)
changed the way ports are added to the server
Diffstat (limited to 'src/csharp/Grpc.Examples.Tests')
-rw-r--r--src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
index 080e733523..08aece7ef2 100644
--- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
+++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
@@ -46,7 +47,7 @@ namespace math.Tests
/// </summary>
public class MathClientServerTest
{
- string host = "localhost";
+ const string Host = "localhost";
Server server;
Channel channel;
Math.MathClient client;
@@ -54,21 +55,14 @@ namespace math.Tests
[TestFixtureSetUp]
public void Init()
{
- server = new Server()
+ server = new Server
{
- Services = { Math.BindService(new MathServiceImpl()) }
+ Services = { Math.BindService(new MathServiceImpl()) },
+ Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
};
- int port = server.AddPort(host, Server.PickUnusedPort, ServerCredentials.Insecure);
server.Start();
- channel = new Channel(host, port, Credentials.Insecure);
+ channel = new Channel(Host, server.Ports.Single().BoundPort, Credentials.Insecure);
client = Math.NewClient(channel);
-
- // TODO(jtattermusch): get rid of the custom header here once we have dedicated tests
- // for header support.
- client.HeaderInterceptor = (metadata) =>
- {
- metadata.Add(new Metadata.Entry("custom-header", "abcdef"));
- };
}
[TestFixtureTearDown]