aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Examples.Tests
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-05-18 16:23:04 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-05-20 18:36:01 -0700
commit2d2652d61b87933c6f790ac7e89066e62821b5b9 (patch)
treee6e8f3d7056486df14333ba6ca31d16cfac1e824 /src/csharp/Grpc.Examples.Tests
parent9f550a3e9901dbe855fe43e381db6bea23c18408 (diff)
implemented disposal logic for calls
Diffstat (limited to 'src/csharp/Grpc.Examples.Tests')
-rw-r--r--src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
index 267852487c..5aa6f4162d 100644
--- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
+++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
@@ -96,7 +96,19 @@ namespace math.Tests
Assert.AreEqual(0, response.Remainder);
}
- // TODO(jtattermusch): test division by zero
+ [Test]
+ public void DivByZero()
+ {
+ try
+ {
+ DivReply response = client.Div(new DivArgs.Builder { Dividend = 0, Divisor = 0 }.Build());
+ Assert.Fail();
+ }
+ catch (RpcException e)
+ {
+ Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode);
+ }
+ }
[Test]
public void DivAsync()
@@ -119,7 +131,6 @@ namespace math.Tests
var responses = await call.ResponseStream.ToList();
CollectionAssert.AreEqual(new List<long> { 1, 1, 2, 3, 5, 8 },
responses.ConvertAll((n) => n.Num_));
-
}
}).Wait();
}
@@ -154,7 +165,6 @@ namespace math.Tests
new DivArgs.Builder { Dividend = 7, Divisor = 2 }.Build()
};
-
using (var call = client.DivMany())
{
await call.RequestStream.WriteAll(divArgsList);