public async Task Build_returns_call_with_response([Frozen] HelloReply result, AsyncClientStreamingTestCallBuilder <HelloRequest, HelloReply> sut) { var call = sut.Build(); var actual = await call; Assert.That(actual, Is.SameAs(result)); }
public async Task Build_returns_call_with_response([Frozen] HelloReply result, AsyncDuplexStreamingTestCallBuilder <HelloRequest, HelloReply> sut) { var call = sut.Build(); var items = await call.ResponseStream.ToListAsync(); Assert.That(items[0], Is.SameAs(result)); }
public async Task WriteAsync_throws_if_called_after_CompleteAsync(MockClientStreamWriter <HelloReply> sut, HelloReply item) { await sut.CompleteAsync(); Assert.That(() => sut.WriteAsync(item), Throws.Exception); }
public async Task Instance_contains_items_passed_via_WriteAsync(MockClientStreamWriter <HelloReply> sut, HelloReply item) { await sut.WriteAsync(item); Assert.That(sut, Contains.Item(item)); }
public async Task Build_returns_call_with_response([Frozen] HelloReply result, AsyncUnaryTestCallBuilder <HelloReply> sut) { var actual = await sut.Build(); Assert.That(actual, Is.SameAs(result)); }
public async Task Service_uses_internal_client_for_duplex_streaming([Frozen] Greeter.GreeterClient client, Service sut, [Frozen] HelloReply reply, AsyncDuplexStreamingCall <HelloRequest, HelloReply> responseCall, string[] names) { Mock.Get(client).Setup(p => p.SayHelloDuplex(null, null, default)).Returns(responseCall); var response = await sut.HelloDuplex(names).ToListAsync(); Assert.That(response, Contains.Item(reply.Message)); }
public async Task Service_uses_internal_client_for_server_streaming([Frozen] Greeter.GreeterClient client, Service sut, [Frozen] HelloReply reply, AsyncServerStreamingCall <HelloReply> responseCall, string name) { Mock.Get(client).Setup(p => p.SayHelloServerStream(It.IsAny <HelloRequest>(), null, null, default)).Returns(responseCall); var response = await sut.ReceiveHelloStream(name).ToListAsync(); Assert.That(response, Contains.Item(reply.Message)); }
public async Task Service_uses_internal_client_for_client_streaming_requests([Frozen] Greeter.GreeterClient client, Service sut, [Frozen] HelloReply reply, AsyncClientStreamingCall <HelloRequest, HelloReply> responseCall, string[] names) { Mock.Get(client).Setup(p => p.SayHelloClientStream(null, null, default)).Returns(responseCall); var response = await sut.StreamHellos(names); Assert.That(response, Is.EqualTo(reply.Message)); }
public async Task Service_uses_internal_client_for_unary_requests([Frozen] Greeter.GreeterClient client, Service sut, [Frozen] HelloReply reply, AsyncUnaryCall <HelloReply> responseCall, string name) { Mock.Get(client).Setup(p => p.SayHelloUnaryAsync(It.IsAny <HelloRequest>(), null, null, default)).Returns(responseCall); var response = await sut.SayHello(name); Assert.That(response, Is.EqualTo(reply.Message)); }
public void AsyncClientStreamingCall_returns_builder(IClientStreamWriter <HelloRequest> requests, HelloReply response) { var call = TestCallBuilder.AsyncClientStreamingCall(requests, response); Assert.That(call, Is.InstanceOf <AsyncClientStreamingTestCallBuilder <HelloRequest, HelloReply> >()); }
public void AsyncUnaryCall_returns_builder(HelloReply response) { var call = TestCallBuilder.AsyncUnaryCall(response); Assert.That(call, Is.InstanceOf <AsyncUnaryTestCallBuilder <HelloReply> >()); }