aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/csharp/Grpc.Examples.MathServer/MathServer.cs2
-rw-r--r--src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs24
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs4
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/HealthServiceImplTest.cs2
-rw-r--r--src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs6
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs131
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs2
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropServer.cs3
-rw-r--r--src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestCredentials.cs2
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs23
11 files changed, 105 insertions, 98 deletions
diff --git a/src/csharp/Grpc.Examples.MathServer/MathServer.cs b/src/csharp/Grpc.Examples.MathServer/MathServer.cs
index 5f7e717b0c..1b71c60141 100644
--- a/src/csharp/Grpc.Examples.MathServer/MathServer.cs
+++ b/src/csharp/Grpc.Examples.MathServer/MathServer.cs
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using Grpc.Core;
-namespace math
+namespace Math
{
class MainClass
{
diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
index 205a1ae3a2..a2348defc3 100644
--- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
+++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
@@ -76,7 +76,7 @@ namespace Math.Tests
[Test]
public void Div1()
{
- DivReply response = client.Div(new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build());
+ DivReply response = client.Div(new DivArgs { Dividend = 10, Divisor = 3 });
Assert.AreEqual(3, response.Quotient);
Assert.AreEqual(1, response.Remainder);
}
@@ -84,7 +84,7 @@ namespace Math.Tests
[Test]
public void Div2()
{
- DivReply response = client.Div(new DivArgs.Builder { Dividend = 0, Divisor = 1 }.Build());
+ DivReply response = client.Div(new DivArgs { Dividend = 0, Divisor = 1 });
Assert.AreEqual(0, response.Quotient);
Assert.AreEqual(0, response.Remainder);
}
@@ -94,7 +94,7 @@ namespace Math.Tests
{
try
{
- DivReply response = client.Div(new DivArgs.Builder { Dividend = 0, Divisor = 0 }.Build());
+ DivReply response = client.Div(new DivArgs { Dividend = 0, Divisor = 0 });
Assert.Fail();
}
catch (RpcException e)
@@ -106,7 +106,7 @@ namespace Math.Tests
[Test]
public async Task DivAsync()
{
- DivReply response = await client.DivAsync(new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build());
+ DivReply response = await client.DivAsync(new DivArgs { Dividend = 10, Divisor = 3 });
Assert.AreEqual(3, response.Quotient);
Assert.AreEqual(1, response.Remainder);
}
@@ -114,7 +114,7 @@ namespace Math.Tests
[Test]
public async Task Fib()
{
- using (var call = client.Fib(new FibArgs.Builder { Limit = 6 }.Build()))
+ using (var call = client.Fib(new FibArgs { Limit = 6 }))
{
var responses = await call.ResponseStream.ToList();
CollectionAssert.AreEqual(new List<long> { 1, 1, 2, 3, 5, 8 },
@@ -127,8 +127,7 @@ namespace Math.Tests
{
var cts = new CancellationTokenSource();
- using (var call = client.Fib(new FibArgs.Builder { Limit = 0 }.Build(),
- cancellationToken: cts.Token))
+ using (var call = client.Fib(new FibArgs { Limit = 0 }, cancellationToken: cts.Token))
{
List<long> responses = new List<long>();
@@ -155,7 +154,7 @@ namespace Math.Tests
[Test]
public async Task FibWithDeadline()
{
- using (var call = client.Fib(new FibArgs.Builder { Limit = 0 }.Build(),
+ using (var call = client.Fib(new FibArgs { Limit = 0 },
deadline: DateTime.UtcNow.AddMilliseconds(500)))
{
try
@@ -176,8 +175,7 @@ namespace Math.Tests
{
using (var call = client.Sum())
{
- var numbers = new List<long> { 10, 20, 30 }.ConvertAll(
- n => Num.CreateBuilder().SetNum_(n).Build());
+ var numbers = new List<long> { 10, 20, 30 }.ConvertAll(n => new Num{ Num_ = n });
await call.RequestStream.WriteAll(numbers);
var result = await call.ResponseAsync;
@@ -190,9 +188,9 @@ namespace Math.Tests
{
var divArgsList = new List<DivArgs>
{
- new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build(),
- new DivArgs.Builder { Dividend = 100, Divisor = 21 }.Build(),
- new DivArgs.Builder { Dividend = 7, Divisor = 2 }.Build()
+ new DivArgs { Dividend = 10, Divisor = 3 },
+ new DivArgs { Dividend = 100, Divisor = 21 },
+ new DivArgs { Dividend = 7, Divisor = 2 }
};
using (var call = client.DivMany())
diff --git a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
index 024377e216..98e24698f3 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
+++ b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
@@ -82,14 +82,14 @@ namespace Grpc.HealthCheck.Tests
{
serviceImpl.SetStatus("", "", HealthCheckResponse.Types.ServingStatus.SERVING);
- var response = client.Check(HealthCheckRequest.CreateBuilder().SetHost("").SetService("").Build());
+ var response = client.Check(new HealthCheckRequest { Host = "", Service = "" });
Assert.AreEqual(HealthCheckResponse.Types.ServingStatus.SERVING, response.Status);
}
[Test]
public void ServiceDoesntExist()
{
- Assert.Throws(Is.TypeOf(typeof(RpcException)).And.Property("Status").Property("StatusCode").EqualTo(StatusCode.NotFound), () => client.Check(HealthCheckRequest.CreateBuilder().SetHost("").SetService("nonexistent.service").Build()));
+ Assert.Throws(Is.TypeOf(typeof(RpcException)).And.Property("Status").Property("StatusCode").EqualTo(StatusCode.NotFound), () => client.Check(new HealthCheckRequest{ Host = "", Service = "nonexistent.service" }));
}
// TODO(jtattermusch): add test with timeout once timeouts are supported
diff --git a/src/csharp/Grpc.HealthCheck.Tests/HealthServiceImplTest.cs b/src/csharp/Grpc.HealthCheck.Tests/HealthServiceImplTest.cs
index 7184415655..04660cd396 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/HealthServiceImplTest.cs
+++ b/src/csharp/Grpc.HealthCheck.Tests/HealthServiceImplTest.cs
@@ -101,7 +101,7 @@ namespace Grpc.HealthCheck.Tests
private static HealthCheckResponse.Types.ServingStatus GetStatusHelper(HealthServiceImpl impl, string host, string service)
{
- return impl.Check(HealthCheckRequest.CreateBuilder().SetHost(host).SetService(service).Build(), null).Result.Status;
+ return impl.Check(new HealthCheckRequest{ Host = host, Service = service}, null).Result.Status;
}
}
}
diff --git a/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs b/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
index 3c3b9c35f1..0fad62d5f1 100644
--- a/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
+++ b/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
@@ -99,8 +99,8 @@ namespace Grpc.HealthCheck
{
lock (myLock)
{
- var host = request.HasHost ? request.Host : "";
- var service = request.HasService ? request.Service : "";
+ var host = request.Host;
+ var service = request.Service;
HealthCheckResponse.Types.ServingStatus status;
if (!statusMap.TryGetValue(CreateKey(host, service), out status))
@@ -108,7 +108,7 @@ namespace Grpc.HealthCheck
// TODO(jtattermusch): returning specific status from server handler is not supported yet.
throw new RpcException(new Status(StatusCode.NotFound, ""));
}
- return Task.FromResult(HealthCheckResponse.CreateBuilder().SetStatus(status).Build());
+ return Task.FromResult(new HealthCheckResponse { Status = status });
}
}
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index 7411d91d5a..93d0bbe772 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -37,12 +37,12 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
-using Google.ProtocolBuffers;
-using grpc.testing;
using Grpc.Auth;
using Grpc.Core;
using Grpc.Core.Utils;
+using Grpc.Testing;
using NUnit.Framework;
+using Google.Protobuf;
namespace Grpc.IntegrationTesting
{
@@ -186,7 +186,7 @@ namespace Grpc.IntegrationTesting
public static void RunEmptyUnary(TestService.ITestServiceClient client)
{
Console.WriteLine("running empty_unary");
- var response = client.EmptyCall(Empty.DefaultInstance);
+ var response = client.EmptyCall(new Empty());
Assert.IsNotNull(response);
Console.WriteLine("Passed!");
}
@@ -194,11 +194,12 @@ namespace Grpc.IntegrationTesting
public static void RunLargeUnary(TestService.ITestServiceClient client)
{
Console.WriteLine("running large_unary");
- var request = SimpleRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .SetResponseSize(314159)
- .SetPayload(CreateZerosPayload(271828))
- .Build();
+ var request = new SimpleRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseSize = 314159,
+ Payload = CreateZerosPayload(271828)
+ };
var response = client.UnaryCall(request);
@@ -211,7 +212,7 @@ namespace Grpc.IntegrationTesting
{
Console.WriteLine("running client_streaming");
- var bodySizes = new List<int> { 27182, 8, 1828, 45904 }.ConvertAll((size) => StreamingInputCallRequest.CreateBuilder().SetPayload(CreateZerosPayload(size)).Build());
+ var bodySizes = new List<int> { 27182, 8, 1828, 45904 }.ConvertAll((size) => new StreamingInputCallRequest { Payload = CreateZerosPayload(size) });
using (var call = client.StreamingInputCall())
{
@@ -229,11 +230,11 @@ namespace Grpc.IntegrationTesting
var bodySizes = new List<int> { 31415, 9, 2653, 58979 };
- var request = StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddRangeResponseParameters(bodySizes.ConvertAll(
- (size) => ResponseParameters.CreateBuilder().SetSize(size).Build()))
- .Build();
+ var request = new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { bodySizes.ConvertAll((size) => new ResponseParameters { Size = size }) }
+ };
using (var call = client.StreamingOutputCall(request))
{
@@ -253,37 +254,45 @@ namespace Grpc.IntegrationTesting
using (var call = client.FullDuplexCall())
{
- await call.RequestStream.WriteAsync(StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415))
- .SetPayload(CreateZerosPayload(27182)).Build());
+ await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { new ResponseParameters { Size = 31415 } },
+ Payload = CreateZerosPayload(27182)
+ });
Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.COMPRESSABLE, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(31415, call.ResponseStream.Current.Payload.Body.Length);
- await call.RequestStream.WriteAsync(StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(9))
- .SetPayload(CreateZerosPayload(8)).Build());
+ await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { new ResponseParameters { Size = 9 } },
+ Payload = CreateZerosPayload(8)
+ });
Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.COMPRESSABLE, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(9, call.ResponseStream.Current.Payload.Body.Length);
- await call.RequestStream.WriteAsync(StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(2653))
- .SetPayload(CreateZerosPayload(1828)).Build());
+ await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { new ResponseParameters { Size = 2653 } },
+ Payload = CreateZerosPayload(1828)
+ });
Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.COMPRESSABLE, call.ResponseStream.Current.Payload.Type);
Assert.AreEqual(2653, call.ResponseStream.Current.Payload.Body.Length);
- await call.RequestStream.WriteAsync(StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(58979))
- .SetPayload(CreateZerosPayload(45904)).Build());
+ await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { new ResponseParameters { Size = 58979 } },
+ Payload = CreateZerosPayload(45904)
+ });
Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.COMPRESSABLE, call.ResponseStream.Current.Payload.Type);
@@ -312,13 +321,14 @@ namespace Grpc.IntegrationTesting
public static void RunServiceAccountCreds(TestService.ITestServiceClient client)
{
Console.WriteLine("running service_account_creds");
- var request = SimpleRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .SetResponseSize(314159)
- .SetPayload(CreateZerosPayload(271828))
- .SetFillUsername(true)
- .SetFillOauthScope(true)
- .Build();
+ var request = new SimpleRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseSize = 314159,
+ Payload = CreateZerosPayload(271828),
+ FillUsername = true,
+ FillOauthScope = true
+ };
var response = client.UnaryCall(request);
@@ -332,13 +342,14 @@ namespace Grpc.IntegrationTesting
public static void RunComputeEngineCreds(TestService.ITestServiceClient client)
{
Console.WriteLine("running compute_engine_creds");
- var request = SimpleRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .SetResponseSize(314159)
- .SetPayload(CreateZerosPayload(271828))
- .SetFillUsername(true)
- .SetFillOauthScope(true)
- .Build();
+ var request = new SimpleRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseSize = 314159,
+ Payload = CreateZerosPayload(271828),
+ FillUsername = true,
+ FillOauthScope = true
+ };
var response = client.UnaryCall(request);
@@ -358,10 +369,11 @@ namespace Grpc.IntegrationTesting
client.HeaderInterceptor = OAuth2Interceptors.FromAccessToken(oauth2Token);
- var request = SimpleRequest.CreateBuilder()
- .SetFillUsername(true)
- .SetFillOauthScope(true)
- .Build();
+ var request = new SimpleRequest
+ {
+ FillUsername = true,
+ FillOauthScope = true
+ };
var response = client.UnaryCall(request);
@@ -379,10 +391,11 @@ namespace Grpc.IntegrationTesting
string oauth2Token = credential.Token.AccessToken;
var headerInterceptor = OAuth2Interceptors.FromAccessToken(oauth2Token);
- var request = SimpleRequest.CreateBuilder()
- .SetFillUsername(true)
- .SetFillOauthScope(true)
- .Build();
+ var request = new SimpleRequest
+ {
+ FillUsername = true,
+ FillOauthScope = true
+ };
var headers = new Metadata();
headerInterceptor(headers);
@@ -424,10 +437,12 @@ namespace Grpc.IntegrationTesting
var cts = new CancellationTokenSource();
using (var call = client.FullDuplexCall(cancellationToken: cts.Token))
{
- await call.RequestStream.WriteAsync(StreamingOutputCallRequest.CreateBuilder()
- .SetResponseType(PayloadType.COMPRESSABLE)
- .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415))
- .SetPayload(CreateZerosPayload(27182)).Build());
+ await call.RequestStream.WriteAsync(new StreamingOutputCallRequest
+ {
+ ResponseType = PayloadType.COMPRESSABLE,
+ ResponseParameters = { new ResponseParameters { Size = 31415 } },
+ Payload = CreateZerosPayload(27182)
+ });
Assert.IsTrue(await call.ResponseStream.MoveNext());
Assert.AreEqual(PayloadType.COMPRESSABLE, call.ResponseStream.Current.Payload.Type);
@@ -452,12 +467,12 @@ namespace Grpc.IntegrationTesting
public static void RunBenchmarkEmptyUnary(TestService.ITestServiceClient client)
{
BenchmarkUtil.RunBenchmark(10000, 10000,
- () => { client.EmptyCall(Empty.DefaultInstance); });
+ () => { client.EmptyCall(new Empty()); });
}
private static Payload CreateZerosPayload(int size)
{
- return Payload.CreateBuilder().SetBody(ByteString.CopyFrom(new byte[size])).Build();
+ return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
}
private static ClientOptions ParseArguments(string[] args)
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index 6fa721bc1c..a827aedbdd 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -36,9 +36,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using grpc.testing;
using Grpc.Core;
using Grpc.Core.Utils;
+using Grpc.Testing;
using NUnit.Framework;
namespace Grpc.IntegrationTesting
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
index 504fd11857..dea0ce752b 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
@@ -37,10 +37,9 @@ using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using Google.ProtocolBuffers;
-using grpc.testing;
using Grpc.Core;
using Grpc.Core.Utils;
+using Grpc.Testing;
using NUnit.Framework;
namespace Grpc.IntegrationTesting
diff --git a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
index 1c398eb84e..08a2d9b31c 100644
--- a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
@@ -37,9 +37,9 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using grpc.testing;
using Grpc.Core;
using Grpc.Core.Utils;
+using Grpc.Testing;
using NUnit.Framework;
namespace Grpc.IntegrationTesting
@@ -93,7 +93,7 @@ namespace Grpc.IntegrationTesting
[Test]
public void AuthenticatedClientAndServer()
{
- var response = client.UnaryCall(SimpleRequest.CreateBuilder().SetResponseSize(10).Build());
+ var response = client.UnaryCall(new SimpleRequest { ResponseSize = 10 });
Assert.AreEqual(10, response.Payload.Body.Length);
}
}
diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
index da0b7fb910..7a48d6e92e 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
@@ -37,8 +37,6 @@ using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using Google.ProtocolBuffers;
-using grpc.testing;
using Grpc.Core;
using Grpc.Core.Utils;
using NUnit.Framework;
diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
index ccf9fe6ced..4ab1266f25 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
@@ -35,11 +35,11 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
-using Google.ProtocolBuffers;
+using Google.Protobuf;
using Grpc.Core;
using Grpc.Core.Utils;
-namespace grpc.testing
+namespace Grpc.Testing
{
/// <summary>
/// Implementation of TestService server
@@ -48,22 +48,20 @@ namespace grpc.testing
{
public Task<Empty> EmptyCall(Empty request, ServerCallContext context)
{
- return Task.FromResult(Empty.DefaultInstance);
+ return Task.FromResult(new Empty());
}
public Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
- var response = SimpleResponse.CreateBuilder()
- .SetPayload(CreateZerosPayload(request.ResponseSize)).Build();
+ var response = new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) };
return Task.FromResult(response);
}
public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
- foreach (var responseParam in request.ResponseParametersList)
+ foreach (var responseParam in request.ResponseParameters)
{
- var response = StreamingOutputCallResponse.CreateBuilder()
- .SetPayload(CreateZerosPayload(responseParam.Size)).Build();
+ var response = new StreamingOutputCallResponse { Payload = CreateZerosPayload(responseParam.Size) };
await responseStream.WriteAsync(response);
}
}
@@ -75,17 +73,16 @@ namespace grpc.testing
{
sum += request.Payload.Body.Length;
});
- return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build();
+ return new StreamingInputCallResponse { AggregatedPayloadSize = sum };
}
public async Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
await requestStream.ForEach(async request =>
{
- foreach (var responseParam in request.ResponseParametersList)
+ foreach (var responseParam in request.ResponseParameters)
{
- var response = StreamingOutputCallResponse.CreateBuilder()
- .SetPayload(CreateZerosPayload(responseParam.Size)).Build();
+ var response = new StreamingOutputCallResponse { Payload = CreateZerosPayload(responseParam.Size) };
await responseStream.WriteAsync(response);
}
});
@@ -98,7 +95,7 @@ namespace grpc.testing
private static Payload CreateZerosPayload(int size)
{
- return Payload.CreateBuilder().SetBody(ByteString.CopyFrom(new byte[size])).Build();
+ return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
}
}
}