Skip to content
Snippets Groups Projects
Commit 0aca838d authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

add a server streaming api test

parent 421d2c41
No related branches found
No related tags found
No related merge requests found
...@@ -181,6 +181,21 @@ namespace Grpc.Core.Internal.Tests ...@@ -181,6 +181,21 @@ namespace Grpc.Core.Internal.Tests
AssertFinished(asyncCallServer, fakeCall, finishedTask); 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) static void AssertFinished(AsyncCallServer<string, string> asyncCallServer, FakeNativeCall fakeCall, Task finishedTask)
{ {
Assert.IsTrue(fakeCall.IsDisposed); Assert.IsTrue(fakeCall.IsDisposed);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment