|
|
|
@ -471,9 +471,17 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
cts.Cancel(); |
|
|
|
|
|
|
|
|
|
var ex = Assert.ThrowsAsync<RpcException>(async () => await call.ResponseStream.MoveNext()); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
// cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. |
|
|
|
|
await call.ResponseStream.MoveNext(); |
|
|
|
|
Assert.Fail(); |
|
|
|
|
} |
|
|
|
|
catch (RpcException ex) |
|
|
|
|
{ |
|
|
|
|
Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Console.WriteLine("Passed!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -577,10 +585,18 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
await call.RequestStream.WriteAsync(request); |
|
|
|
|
await call.RequestStream.CompleteAsync(); |
|
|
|
|
|
|
|
|
|
var e = Assert.ThrowsAsync<RpcException>(async () => await call.ResponseStream.ToListAsync()); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
// cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. |
|
|
|
|
await call.ResponseStream.ToListAsync(); |
|
|
|
|
Assert.Fail(); |
|
|
|
|
} |
|
|
|
|
catch (RpcException e) |
|
|
|
|
{ |
|
|
|
|
Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); |
|
|
|
|
Assert.AreEqual(echoStatus.Message, e.Status.Detail); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Console.WriteLine("Passed!"); |
|
|
|
|
} |
|
|
|
|