add tests for sync unary

pull/16554/head
Jan Tattermusch 6 years ago
parent ee510fb328
commit 603a9a0635
  1. 18
      src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs
  2. 1
      src/csharp/Grpc.Core.Tests/Internal/FakeNativeCall.cs

@ -124,6 +124,24 @@ namespace Grpc.Core.Internal.Tests
Assert.IsTrue(fakeCall.IsDisposed); Assert.IsTrue(fakeCall.IsDisposed);
} }
[Test]
public void SyncUnary_RequestSerializationExceptionDoesntLeakResources()
{
string nullRequest = null; // will throw when serializing
Assert.Throws(typeof(ArgumentNullException), () => asyncCall.UnaryCall(nullRequest));
Assert.AreEqual(0, channel.GetCallReferenceCount());
Assert.IsTrue(fakeCall.IsDisposed);
}
[Test]
public void SyncUnary_StartCallFailureDoesntLeakResources()
{
fakeCall.MakeStartCallFail();
Assert.Throws(typeof(InvalidOperationException), () => asyncCall.UnaryCall("request1"));
Assert.AreEqual(0, channel.GetCallReferenceCount());
Assert.IsTrue(fakeCall.IsDisposed);
}
[Test] [Test]
public void ClientStreaming_StreamingReadNotAllowed() public void ClientStreaming_StreamingReadNotAllowed()
{ {

@ -109,6 +109,7 @@ namespace Grpc.Core.Internal.Tests
public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{ {
StartCallMaybeFail();
throw new NotImplementedException(); throw new NotImplementedException();
} }

Loading…
Cancel
Save