|
|
|
@ -109,7 +109,7 @@ namespace math.Tests |
|
|
|
|
{ |
|
|
|
|
using (var call = client.Fib(new FibArgs.Builder { Limit = 6 }.Build())) |
|
|
|
|
{ |
|
|
|
|
var responses = await call.ResponseStream.ToList(); |
|
|
|
|
var responses = await call.ResponseStream.ToListAsync(); |
|
|
|
|
CollectionAssert.AreEqual(new List<long> { 1, 1, 2, 3, 5, 8 }, |
|
|
|
|
responses.ConvertAll((n) => n.Num_)); |
|
|
|
|
} |
|
|
|
@ -151,7 +151,7 @@ namespace math.Tests |
|
|
|
|
using (var call = client.Fib(new FibArgs.Builder { Limit = 0 }.Build(), |
|
|
|
|
deadline: DateTime.UtcNow.AddMilliseconds(500))) |
|
|
|
|
{ |
|
|
|
|
var ex = Assert.Throws<RpcException>(async () => await call.ResponseStream.ToList()); |
|
|
|
|
var ex = Assert.Throws<RpcException>(async () => await call.ResponseStream.ToListAsync()); |
|
|
|
|
|
|
|
|
|
// We can't guarantee the status code always DeadlineExceeded. See issue #2685. |
|
|
|
|
Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); |
|
|
|
@ -167,7 +167,7 @@ namespace math.Tests |
|
|
|
|
var numbers = new List<long> { 10, 20, 30 }.ConvertAll( |
|
|
|
|
n => Num.CreateBuilder().SetNum_(n).Build()); |
|
|
|
|
|
|
|
|
|
await call.RequestStream.WriteAll(numbers); |
|
|
|
|
await call.RequestStream.WriteAllAsync(numbers); |
|
|
|
|
var result = await call.ResponseAsync; |
|
|
|
|
Assert.AreEqual(60, result.Num_); |
|
|
|
|
} |
|
|
|
@ -185,8 +185,8 @@ namespace math.Tests |
|
|
|
|
|
|
|
|
|
using (var call = client.DivMany()) |
|
|
|
|
{ |
|
|
|
|
await call.RequestStream.WriteAll(divArgsList); |
|
|
|
|
var result = await call.ResponseStream.ToList(); |
|
|
|
|
await call.RequestStream.WriteAllAsync(divArgsList); |
|
|
|
|
var result = await call.ResponseStream.ToListAsync(); |
|
|
|
|
|
|
|
|
|
CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.ConvertAll((divReply) => divReply.Quotient)); |
|
|
|
|
CollectionAssert.AreEqual(new long[] { 1, 16, 1 }, result.ConvertAll((divReply) => divReply.Remainder)); |
|
|
|
|