rename Result to ResponseAsync

pull/2597/head
Jan Tattermusch 9 years ago
parent 7d219cfe4a
commit a236ff205b
  1. 8
      src/csharp/Grpc.Core.Tests/ClientServerTest.cs
  2. 12
      src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
  3. 12
      src/csharp/Grpc.Core/AsyncUnaryCall.cs
  4. 2
      src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
  5. 4
      src/csharp/Grpc.Examples/MathExamples.cs
  6. 4
      src/csharp/Grpc.IntegrationTesting/InteropClient.cs

@ -152,7 +152,7 @@ namespace Grpc.Core.Tests
public void AsyncUnaryCall()
{
var call = new Call<string, string>(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<string, string>(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);

@ -43,15 +43,15 @@ namespace Grpc.Core
public sealed class AsyncClientStreamingCall<TRequest, TResponse> : IDisposable
{
readonly IClientStreamWriter<TRequest> requestStream;
readonly Task<TResponse> result;
readonly Task<TResponse> responseAsync;
readonly Func<Status> getStatusFunc;
readonly Func<Metadata> getTrailersFunc;
readonly Action disposeAction;
public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> result, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Func<Status> getStatusFunc, Func<Metadata> 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
/// <summary>
/// Asynchronous call result.
/// </summary>
public Task<TResponse> Result
public Task<TResponse> ResponseAsync
{
get
{
return this.result;
return this.responseAsync;
}
}
@ -85,7 +85,7 @@ namespace Grpc.Core
/// <returns></returns>
public TaskAwaiter<TResponse> GetAwaiter()
{
return result.GetAwaiter();
return responseAsync.GetAwaiter();
}
/// <summary>

@ -42,14 +42,14 @@ namespace Grpc.Core
/// </summary>
public sealed class AsyncUnaryCall<TResponse> : IDisposable
{
readonly Task<TResponse> result;
readonly Task<TResponse> responseAsync;
readonly Func<Status> getStatusFunc;
readonly Func<Metadata> getTrailersFunc;
readonly Action disposeAction;
public AsyncUnaryCall(Task<TResponse> result, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
public AsyncUnaryCall(Task<TResponse> responseAsync, Func<Status> getStatusFunc, Func<Metadata> 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
/// <summary>
/// Asynchronous call result.
/// </summary>
public Task<TResponse> Result
public Task<TResponse> ResponseAsync
{
get
{
return this.result;
return this.responseAsync;
}
}
@ -71,7 +71,7 @@ namespace Grpc.Core
/// </summary>
public TaskAwaiter<TResponse> GetAwaiter()
{
return result.GetAwaiter();
return responseAsync.GetAwaiter();
}
/// <summary>

@ -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();

@ -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());

@ -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)

Loading…
Cancel
Save