improve asserts

pull/22891/head
Jan Tattermusch 5 years ago
parent fa99395610
commit 860d6e5e26
  1. 4
      src/csharp/Grpc.Core.Tests/ClientServerTest.cs

@ -150,12 +150,12 @@ namespace Grpc.Core.Tests
var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
Assert.AreEqual(StatusCode.Unauthenticated, ex.Status.StatusCode); Assert.AreEqual(StatusCode.Unauthenticated, ex.Status.StatusCode);
Assert.IsTrue(ex.Status.DebugErrorString.Contains("Error received from peer")); // a different debug error string set by grpc client StringAssert.Contains("Error received from peer", ex.Status.DebugErrorString, "Is \"Error received from peer\" still a valid substring to search for in the client-generated error message from C-core?");
Assert.AreEqual(0, ex.Trailers.Count); Assert.AreEqual(0, ex.Trailers.Count);
var ex2 = Assert.ThrowsAsync<RpcException>(async () => await Calls.AsyncUnaryCall(helper.CreateUnaryCall(), "abc")); var ex2 = Assert.ThrowsAsync<RpcException>(async () => await Calls.AsyncUnaryCall(helper.CreateUnaryCall(), "abc"));
Assert.AreEqual(StatusCode.Unauthenticated, ex2.Status.StatusCode); Assert.AreEqual(StatusCode.Unauthenticated, ex2.Status.StatusCode);
Assert.IsTrue(ex2.Status.DebugErrorString.Contains("Error received from peer")); // a different debug error string set by grpc client StringAssert.Contains("Error received from peer", ex2.Status.DebugErrorString, "Is \"Error received from peer\" still a valid substring to search for in the client-generated error message from C-core?");
Assert.AreEqual(0, ex2.Trailers.Count); Assert.AreEqual(0, ex2.Trailers.Count);
} }

Loading…
Cancel
Save