diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2016-05-09 13:03:59 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2016-05-18 21:10:24 -0700 |
commit | a41c58c26d33a99eba8b0dede0fbafbfdfe99e5c (patch) | |
tree | 007d1f5097a75482152dc12d6f7c9d7a5e012d27 /src | |
parent | 18ef23ee39739c7393b997aaaba5908be16b8af9 (diff) |
fixup tests
Diffstat (limited to 'src')
-rw-r--r-- | src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs index 6f8668d143..777a1c8c50 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs @@ -212,7 +212,23 @@ namespace Grpc.Core.Internal.Tests AssertUnaryResponseSuccess(asyncCall, fakeCall, resultTask); var ex = Assert.Throws<RpcException>(() => requestStream.WriteAsync("request1")); - //TODO: add assert. + Assert.AreEqual(Status.DefaultSuccess, ex.Status); + } + + [Test] + public void ClientStreaming_WriteAfterReceivingStatusThrowsRpcException2() + { + var resultTask = asyncCall.ClientStreamingCallAsync(); + var requestStream = new ClientRequestStream<string, string>(asyncCall); + + fakeCall.UnaryResponseClientHandler(true, + new ClientSideStatus(new Status(StatusCode.OutOfRange, ""), new Metadata()), + CreateResponsePayload(), + new Metadata()); + + AssertUnaryResponseError(asyncCall, fakeCall, resultTask, StatusCode.OutOfRange); + var ex = Assert.Throws<RpcException>(() => requestStream.WriteAsync("request1")); + Assert.AreEqual(StatusCode.OutOfRange, ex.Status.StatusCode); } [Test] @@ -375,7 +391,7 @@ namespace Grpc.Core.Internal.Tests AssertStreamingResponseSuccess(asyncCall, fakeCall, readTask); var ex = Assert.ThrowsAsync<RpcException>(async () => await requestStream.WriteAsync("request1")); - //TODO: add assert. + Assert.AreEqual(Status.DefaultSuccess, ex.Status); } [Test] |