public async Task SendValidRequest_WithConnectionOptions(TestServerEndpointName endpointName, string?version, bool success) { SetExpectedErrorsFilter(writeContext => { return(!success); }); // Arrage Version.TryParse(version, out var v); var channel = CreateGrpcWebChannel(endpointName, v); var client = new EchoService.EchoServiceClient(channel); // Act var call = client.EchoAsync(new EchoRequest { Message = "test" }).ResponseAsync.DefaultTimeout(); // Assert if (success) { Assert.AreEqual("test", (await call).Message); } else { await ExceptionAssert.ThrowsAsync <RpcException>(async() => await call); } }
private HttpClient CreateGrpcWebClient(TestServerEndpointName endpointName, Version?version) { GrpcWebHandler grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb); grpcWebHandler.HttpVersion = version; return(Fixture.CreateClient(endpointName, grpcWebHandler)); }
private GrpcChannel CreateGrpcWebChannel(TestServerEndpointName endpointName, Version?version) { var httpClient = CreateGrpcWebClient(endpointName, version); var channel = GrpcChannel.ForAddress(httpClient.BaseAddress !, new GrpcChannelOptions { HttpClient = httpClient, LoggerFactory = LoggerFactory }); return(channel); }
protected GrpcWebFunctionalTestBase(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) { GrpcTestMode = grpcTestMode; EndpointName = endpointName; #if NET6_0_OR_GREATER if (endpointName == TestServerEndpointName.Http3WithTls && !RequireHttp3Attribute.IsSupported(out var message)) { Assert.Ignore(message); } #endif }
private GrpcChannel CreateGrpcWebChannel(TestServerEndpointName endpointName, Version?version) { var grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb); grpcWebHandler.HttpVersion = version; var httpClient = Fixture.CreateClient(endpointName, grpcWebHandler); var channel = GrpcChannel.ForAddress(httpClient.BaseAddress !, new GrpcChannelOptions { HttpClient = httpClient, LoggerFactory = LoggerFactory }); return(channel); }
public async Task SendValidRequest_WithConnectionOptions(TestServerEndpointName endpointName, string?version, bool success) { #if NET6_0_OR_GREATER if (endpointName == TestServerEndpointName.Http3WithTls && !RequireHttp3Attribute.IsSupported(out var message)) { Assert.Ignore(message); } #endif SetExpectedErrorsFilter(writeContext => { return(!success); }); // Arrage Version.TryParse(version, out var v); var channel = CreateGrpcWebChannel(endpointName, v); var client = new EchoService.EchoServiceClient(channel); // Act var call = client.EchoAsync(new EchoRequest { Message = "test" }).ResponseAsync.DefaultTimeout(); // Assert if (success) { Assert.AreEqual("test", (await call.DefaultTimeout()).Message); } else { await ExceptionAssert.ThrowsAsync <RpcException>(async() => await call).DefaultTimeout(); } }
public IssueTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }
public TrailerMetadataTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }
public ServerStreamingMethodTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }
public UnaryMethodTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }
public DeadlineTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }
public abstract string GetUrl(TestServerEndpointName endpointName);
protected GrpcWebFunctionalTestBase(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) { _grpcTestMode = grpcTestMode; _endpointName = endpointName; }
public ClientFactoryTests(GrpcTestMode grpcTestMode, TestServerEndpointName endpointName) : base(grpcTestMode, endpointName) { }