From a236ff205ba3211dc547e20f6b0689df4b542858 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 21 Jul 2015 12:33:31 -0700 Subject: [PATCH] rename Result to ResponseAsync --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 8 ++++---- src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 12 ++++++------ src/csharp/Grpc.Core/AsyncUnaryCall.cs | 12 ++++++------ .../Grpc.Examples.Tests/MathClientServerTests.cs | 2 +- src/csharp/Grpc.Examples/MathExamples.cs | 4 ++-- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 87055b1adc3..98fc6b4f10f 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -152,7 +152,7 @@ namespace Grpc.Core.Tests public void AsyncUnaryCall() { var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); - var result = Calls.AsyncUnaryCall(call, "ABC", CancellationToken.None).Result.Result; + var result = Calls.AsyncUnaryCall(call, "ABC", CancellationToken.None).ResponseAsync.Result; Assert.AreEqual("ABC", result); } @@ -183,7 +183,7 @@ namespace Grpc.Core.Tests var callResult = Calls.AsyncClientStreamingCall(call, CancellationToken.None); await callResult.RequestStream.WriteAll(new string[] { "A", "B", "C" }); - Assert.AreEqual("ABC", await callResult.Result); + Assert.AreEqual("ABC", await callResult.ResponseAsync); }).Wait(); } @@ -203,7 +203,7 @@ namespace Grpc.Core.Tests try { - await callResult.Result; + await callResult.ResponseAsync; } catch (RpcException e) { @@ -223,7 +223,7 @@ namespace Grpc.Core.Tests var call = new Call(ServiceName, EchoMethod, channel, headers); var callResult = Calls.AsyncUnaryCall(call, "ABC", CancellationToken.None); - Assert.AreEqual("ABC", callResult.Result.Result); + Assert.AreEqual("ABC", callResult.ResponseAsync.Result); Assert.AreEqual(StatusCode.OK, callResult.GetStatus().StatusCode); diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index 98ebeea3188..bf020cd6274 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -43,15 +43,15 @@ namespace Grpc.Core public sealed class AsyncClientStreamingCall : IDisposable { readonly IClientStreamWriter requestStream; - readonly Task result; + readonly Task responseAsync; readonly Func getStatusFunc; readonly Func getTrailersFunc; readonly Action disposeAction; - public AsyncClientStreamingCall(IClientStreamWriter requestStream, Task result, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) + public AsyncClientStreamingCall(IClientStreamWriter requestStream, Task responseAsync, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) { this.requestStream = requestStream; - this.result = result; + this.responseAsync = responseAsync; this.getStatusFunc = getStatusFunc; this.getTrailersFunc = getTrailersFunc; this.disposeAction = disposeAction; @@ -60,11 +60,11 @@ namespace Grpc.Core /// /// Asynchronous call result. /// - public Task Result + public Task ResponseAsync { get { - return this.result; + return this.responseAsync; } } @@ -85,7 +85,7 @@ namespace Grpc.Core /// public TaskAwaiter GetAwaiter() { - return result.GetAwaiter(); + return responseAsync.GetAwaiter(); } /// diff --git a/src/csharp/Grpc.Core/AsyncUnaryCall.cs b/src/csharp/Grpc.Core/AsyncUnaryCall.cs index c644d477efa..224e3439160 100644 --- a/src/csharp/Grpc.Core/AsyncUnaryCall.cs +++ b/src/csharp/Grpc.Core/AsyncUnaryCall.cs @@ -42,14 +42,14 @@ namespace Grpc.Core /// public sealed class AsyncUnaryCall : IDisposable { - readonly Task result; + readonly Task responseAsync; readonly Func getStatusFunc; readonly Func getTrailersFunc; readonly Action disposeAction; - public AsyncUnaryCall(Task result, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) + public AsyncUnaryCall(Task responseAsync, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) { - this.result = result; + this.responseAsync = responseAsync; this.getStatusFunc = getStatusFunc; this.getTrailersFunc = getTrailersFunc; this.disposeAction = disposeAction; @@ -58,11 +58,11 @@ namespace Grpc.Core /// /// Asynchronous call result. /// - public Task Result + public Task ResponseAsync { get { - return this.result; + return this.responseAsync; } } @@ -71,7 +71,7 @@ namespace Grpc.Core /// public TaskAwaiter GetAwaiter() { - return result.GetAwaiter(); + return responseAsync.GetAwaiter(); } /// diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index e7c4b331208..7a957c5b6ff 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -144,7 +144,7 @@ namespace math.Tests n => Num.CreateBuilder().SetNum_(n).Build()); await call.RequestStream.WriteAll(numbers); - var result = await call.Result; + var result = await call.ResponseAsync; Assert.AreEqual(60, result.Num_); } }).Wait(); diff --git a/src/csharp/Grpc.Examples/MathExamples.cs b/src/csharp/Grpc.Examples/MathExamples.cs index 90956f65a24..06d81a4d83d 100644 --- a/src/csharp/Grpc.Examples/MathExamples.cs +++ b/src/csharp/Grpc.Examples/MathExamples.cs @@ -71,7 +71,7 @@ namespace math using (var call = client.Sum()) { await call.RequestStream.WriteAll(numbers); - Console.WriteLine("Sum Result: " + await call.Result); + Console.WriteLine("Sum Result: " + await call.ResponseAsync); } } @@ -103,7 +103,7 @@ namespace math using (var sumCall = client.Sum()) { await sumCall.RequestStream.WriteAll(numbers); - sum = await sumCall.Result; + sum = await sumCall.ResponseAsync; } DivReply result = await client.DivAsync(new DivArgs.Builder { Dividend = sum.Num_, Divisor = numbers.Count }.Build()); diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index ea83aaf2c12..2746dc945e8 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -219,7 +219,7 @@ namespace Grpc.IntegrationTesting { await call.RequestStream.WriteAll(bodySizes); - var response = await call.Result; + var response = await call.ResponseAsync; Assert.AreEqual(74922, response.AggregatedPayloadSize); } Console.WriteLine("Passed!"); @@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting try { - var response = await call.Result; + var response = await call.ResponseAsync; Assert.Fail(); } catch (RpcException e)