public async Task StructAsyncUnaryCall() { for (int i = 0; i < ClientRepeatCount; ++i) { TestRequestStruct request = UnitTest1.GetRequestStruct(1); TestResponseStruct response = await UnitTest1.Client.StructAsyncUnaryCall(request).ConfigureAwait(false); } }
public void StructBlockingUnaryCall() { for (int i = 0; i < ClientRepeatCount; ++i) { TestRequestStruct request = UnitTest1.GetRequestStruct(1); TestResponseStruct response = UnitTest1.Client.StructBlockingUnaryCall(request); } }
public async Task WriteAllAndReadAsync_Async() { using (var call = UnitTest1.Client.DuplexStreaming()) { IList <TestResponse> responses = await call.WriteAllAndReadAsync(UnitTest1.GetRequestsAsync(3)).ConfigureAwait(false); Assert.AreEqual(6, responses.Count); } }
public async Task StructWriteAllAndFillAsync() { using (var call = UnitTest1.Client.StructDuplexStreaming()) { List <TestResponseStruct> responses = new List <TestResponseStruct>(); await call.WriteAllAndFillAsync(UnitTest1.GetRequestStructs(3), responses).ConfigureAwait(false); Assert.AreEqual(6, responses.Count); } }
public async Task StructServerStreaming() { using (var call = UnitTest1.Client.StructServerStreaming(UnitTest1.GetRequestStruct(ServerRepeatCount))) { while (await call.ResponseStream.MoveNext(System.Threading.CancellationToken.None).ConfigureAwait(false)) { TestResponseStruct response = call.ResponseStream.Current; } } }
public async Task StructWriteAllAndForEachAsync() { void onReponse(TestResponseStruct response) { Console.WriteLine($"{response.IntValue}, {response.DateTimeValue}"); } using (var call = UnitTest1.Client.StructDuplexStreaming()) { await call.WriteAllAndForEachAsync(UnitTest1.GetRequestStructs(4), (Action <TestResponseStruct>) onReponse).ConfigureAwait(false); } }
public async Task StructDuplexStreaming() { void onResponse(TestResponseStruct response) { int value = response.IntValue; }; using (var call = UnitTest1.Client.StructDuplexStreaming()) { await call.WriteAllAndForEachAsync(UnitTest1.GetRequestStructs(ServerRepeatCount), (Action <TestResponseStruct>) onResponse); } }
public async Task WriteAllAndForEachAsync_Async() { Task onReponse(TestResponse response) { Console.WriteLine($"{response.IntValue}, {response.DateTimeValue}"); return(Task.CompletedTask); } using (var call = UnitTest1.Client.DuplexStreaming()) { await call.WriteAllAndForEachAsync(UnitTest1.GetRequests(4), onReponse).ConfigureAwait(false); } }
public async Task StructClientStreaming() { using (var call = UnitTest1.Client.StructClientStreaming()) { for (int i = 0; i < ClientRepeatCount; ++i) { await call.RequestStream.WriteAsync(UnitTest1.GetRequestStruct(1)).ConfigureAwait(false); } await call.RequestStream.CompleteAsync().ConfigureAwait(false); TestResponseStruct response = await call.ResponseAsync.ConfigureAwait(false); } }
public async Task WriteRequestStructsAsync() { using (var call = UnitTest1.Client.StructClientStreaming()) { await call.WriteRequestsAsync(UnitTest1.GetRequestStructs(3)).ConfigureAwait(false); await call.WriteRequestsAsync(UnitTest1.GetRequestStructsAsync(3)).ConfigureAwait(false); await call.WriteRequestsAndCompleteAsync(UnitTest1.GetRequestStructs(3)).ConfigureAwait(false); TestResponseStruct response = await call.ResponseAsync.ConfigureAwait(false); Assert.AreEqual(18, response.IntValue); } }
public async Task StructConvertResponse() { int convert(TestResponseStruct response) { return(response.IntValue); } using (var call = UnitTest1.Client.StructClientStreaming().ConvertResponse((Func <TestResponseStruct, int>)convert)) { await call.WriteRequestsAndCompleteAsync(UnitTest1.GetRequestStructs(3)).ConfigureAwait(false); int response = await call.ResponseAsync.ConfigureAwait(false); Assert.AreEqual(6, response); } }
public async Task StructConvertResponse() { int convert(TestResponseStruct response) { return(response.IntValue); } using (var call = UnitTest1.Client.StructDuplexStreaming().ConvertResponse((Func <TestResponseStruct, int>)convert)) { IList <int> responses = await call.WriteAllAndReadAsync(UnitTest1.GetRequestStructs(3)).ConfigureAwait(false); int summary = 0; foreach (int value in responses) { summary += value; } Assert.AreEqual(10, summary); } }