diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-07-21 12:23:31 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-07-21 12:23:31 -0700 |
commit | 7d219cfe4afe61b96c235dffb049bb856a62124e (patch) | |
tree | 475efa21e705627448db9f157495aff421b642c3 /src | |
parent | 25bb2ef8b84651bff7175ac221448da152f03dad (diff) |
fix echo metadata test
Diffstat (limited to 'src')
-rw-r--r-- | src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index a10529a614..87055b1adc 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -129,7 +129,7 @@ namespace Grpc.Core.Tests } catch (RpcException e) { - Assert.AreEqual(StatusCode.Unauthenticated, e.Status.StatusCode); + Assert.AreEqual(StatusCode.Unauthenticated, e.Status.StatusCode); } } @@ -215,18 +215,25 @@ namespace Grpc.Core.Tests [Test] public void AsyncUnaryCall_EchoMetadata() { - var metadata = new Metadata + var headers = new Metadata { new Metadata.Entry("asciiHeader", "abcdefg"), new Metadata.Entry("binaryHeader-bin", new byte[] { 1, 2, 3, 0, 0xff } ), }; - var call = new Call<string, string>(ServiceName, EchoMethod, channel, metadata); + var call = new Call<string, string>(ServiceName, EchoMethod, channel, headers); var callResult = Calls.AsyncUnaryCall(call, "ABC", CancellationToken.None); Assert.AreEqual("ABC", callResult.Result.Result); - // TODO: implement assertion... - //Assert.Fail(); + Assert.AreEqual(StatusCode.OK, callResult.GetStatus().StatusCode); + + var trailers = callResult.GetTrailers(); + Assert.AreEqual(2, trailers.Count); + Assert.AreEqual(headers[0].Key, trailers[0].Key); + Assert.AreEqual(headers[0].Value, trailers[0].Value); + + Assert.AreEqual(headers[1].Key, trailers[1].Key); + CollectionAssert.AreEqual(headers[1].ValueBytes, trailers[1].ValueBytes); } [Test] |