aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.IntegrationTesting
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.IntegrationTesting')
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs16
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropServer.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs10
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestCredentials.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs33
6 files changed, 28 insertions, 43 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index 2992c42ae9..56760ecdab 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -38,10 +38,10 @@ 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;
-using grpc.testing;
namespace Grpc.IntegrationTesting
{
@@ -50,7 +50,7 @@ namespace Grpc.IntegrationTesting
private class ClientOptions
{
public bool help;
- public string serverHost= "127.0.0.1";
+ public string serverHost = "127.0.0.1";
public string serverHostOverride = TestCredentials.DefaultHostOverride;
public int? serverPort;
public string testCase = "large_unary";
@@ -180,7 +180,7 @@ namespace Grpc.IntegrationTesting
{
Console.WriteLine("running client_streaming");
- var bodySizes = new List<int>{27182, 8, 1828, 45904};
+ var bodySizes = new List<int> { 27182, 8, 1828, 45904 };
var context = client.StreamingInputCall();
foreach (var size in bodySizes)
@@ -199,7 +199,7 @@ namespace Grpc.IntegrationTesting
{
Console.WriteLine("running server_streaming");
- var bodySizes = new List<int>{31415, 9, 2653, 58979};
+ var bodySizes = new List<int> { 31415, 9, 2653, 58979 };
var request = StreamingOutputCallRequest.CreateBuilder()
.SetResponseType(PayloadType.COMPRESSABLE)
@@ -256,7 +256,6 @@ namespace Grpc.IntegrationTesting
Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type);
Assert.AreEqual(2653, response.Payload.Body.Length);
-
inputs.OnNext(StreamingOutputCallRequest.CreateBuilder()
.SetResponseType(PayloadType.COMPRESSABLE)
.AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(58979))
@@ -292,17 +291,18 @@ namespace Grpc.IntegrationTesting
public static void RunBenchmarkEmptyUnary(TestServiceGrpc.ITestServiceClient client)
{
BenchmarkUtil.RunBenchmark(10000, 10000,
- () => { client.EmptyCall(Empty.DefaultInstance);});
+ () => { client.EmptyCall(Empty.DefaultInstance); });
}
- private static Payload CreateZerosPayload(int size) {
+ private static Payload CreateZerosPayload(int size)
+ {
return Payload.CreateBuilder().SetBody(ByteString.CopyFrom(new byte[size])).Build();
}
private static ClientOptions ParseArguments(string[] args)
{
var options = new ClientOptions();
- foreach(string arg in args)
+ foreach (string arg in args)
{
ParseArgument(arg, options);
if (options.help)
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index ab2d6f4a6a..36c784e28f 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -35,10 +35,10 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using grpc.testing;
using Grpc.Core;
using Grpc.Core.Utils;
using NUnit.Framework;
-using grpc.testing;
namespace Grpc.IntegrationTesting
{
@@ -117,7 +117,5 @@ namespace Grpc.IntegrationTesting
// TODO: add cancel_after_begin
// TODO: add cancel_after_first_response
-
}
}
-
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
index 24d72da0c3..5e580280b6 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
@@ -38,10 +38,10 @@ 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;
-using grpc.testing;
namespace Grpc.IntegrationTesting
{
@@ -113,7 +113,7 @@ namespace Grpc.IntegrationTesting
private static ServerOptions ParseArguments(string[] args)
{
var options = new ServerOptions();
- foreach(string arg in args)
+ foreach (string arg in args)
{
ParseArgument(arg, options);
if (options.help)
diff --git a/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs
index f633c19132..f09a448e9e 100644
--- a/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs
@@ -1,8 +1,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
[assembly: AssemblyTitle("Grpc.IntegrationTesting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -11,12 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("0.1.*")]
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
index b31abf1181..10df704f1d 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
@@ -38,10 +38,10 @@ 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;
-using grpc.testing;
namespace Grpc.IntegrationTesting
{
@@ -77,7 +77,7 @@ namespace Grpc.IntegrationTesting
var keyCertPair = new KeyCertificatePair(
File.ReadAllText(ServerCertChainPath),
File.ReadAllText(ServerPrivateKeyPath));
- return new SslServerCredentials(new List<KeyCertificatePair> {keyCertPair});
+ return new SslServerCredentials(new List<KeyCertificatePair> { keyCertPair });
}
}
}
diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
index 176843b130..661b31b0ee 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
@@ -55,14 +55,14 @@ namespace grpc.testing
{
var response = SimpleResponse.CreateBuilder()
.SetPayload(CreateZerosPayload(request.ResponseSize)).Build();
- //TODO: check we support ReponseType
+ // TODO: check we support ReponseType
responseObserver.OnNext(response);
responseObserver.OnCompleted();
}
public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver)
{
- foreach(var responseParam in request.ResponseParametersList)
+ foreach (var responseParam in request.ResponseParametersList)
{
var response = StreamingOutputCallResponse.CreateBuilder()
.SetPayload(CreateZerosPayload(responseParam.Size)).Build();
@@ -74,9 +74,10 @@ namespace grpc.testing
public IObserver<StreamingInputCallRequest> StreamingInputCall(IObserver<StreamingInputCallResponse> responseObserver)
{
var recorder = new RecordingObserver<StreamingInputCallRequest>();
- Task.Run(() => {
+ Task.Run(() =>
+ {
int sum = 0;
- foreach(var req in recorder.ToList().Result)
+ foreach (var req in recorder.ToList().Result)
{
sum += req.Payload.Body.Length;
}
@@ -98,8 +99,8 @@ namespace grpc.testing
throw new NotImplementedException();
}
- private class FullDuplexObserver : IObserver<StreamingOutputCallRequest> {
-
+ private class FullDuplexObserver : IObserver<StreamingOutputCallRequest>
+ {
readonly IObserver<StreamingOutputCallResponse> responseObserver;
public FullDuplexObserver(IObserver<StreamingOutputCallResponse> responseObserver)
@@ -119,22 +120,18 @@ namespace grpc.testing
public void OnNext(StreamingOutputCallRequest value)
{
- // TODO: this is not in order!!!
- //Task.Factory.StartNew(() => {
-
- foreach(var responseParam in value.ResponseParametersList)
- {
- var response = StreamingOutputCallResponse.CreateBuilder()
- .SetPayload(CreateZerosPayload(responseParam.Size)).Build();
- responseObserver.OnNext(response);
- }
- //});
+ foreach (var responseParam in value.ResponseParametersList)
+ {
+ var response = StreamingOutputCallResponse.CreateBuilder()
+ .SetPayload(CreateZerosPayload(responseParam.Size)).Build();
+ responseObserver.OnNext(response);
+ }
}
}
- private static Payload CreateZerosPayload(int size) {
+ private static Payload CreateZerosPayload(int size)
+ {
return Payload.CreateBuilder().SetBody(ByteString.CopyFrom(new byte[size])).Build();
}
}
}
-