aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-23 11:01:54 -0400
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-23 11:06:42 -0400
commit0aca838d7d33df47e3b7839b29c50855ab960ef8 (patch)
tree3aee88fb2d6412e16d46733ec1676249055e768b /src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs
parent421d2c411a06e2f5e5fd1e03e439c27df73cefc6 (diff)
add a server streaming api test
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs')
-rw-r--r--src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs
index 0e204761f6..f14a61d34f 100644
--- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs
+++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs
@@ -181,6 +181,21 @@ namespace Grpc.Core.Internal.Tests
AssertFinished(asyncCallServer, fakeCall, finishedTask);
}
+ [Test]
+ public void WriteAfterWriteStatusThrowsInvalidOperationException()
+ {
+ var finishedTask = asyncCallServer.ServerSideCallAsync();
+ var responseStream = new ServerResponseStream<string, string>(asyncCallServer);
+
+ asyncCallServer.SendStatusFromServerAsync(Status.DefaultSuccess, new Metadata(), null);
+ Assert.ThrowsAsync(typeof(InvalidOperationException), async () => await responseStream.WriteAsync("request1"));
+
+ fakeCall.SendStatusFromServerHandler(true);
+ fakeCall.ReceivedCloseOnServerHandler(true, cancelled: true);
+
+ AssertFinished(asyncCallServer, fakeCall, finishedTask);
+ }
+
static void AssertFinished(AsyncCallServer<string, string> asyncCallServer, FakeNativeCall fakeCall, Task finishedTask)
{
Assert.IsTrue(fakeCall.IsDisposed);