public void SameEndpoint_SameChannel() { var pool = new ChannelPool(ServiceMetadata); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(Grpc, fixture.Endpoint, GrpcChannelOptions.Empty); var channel2 = pool.GetChannel(Grpc, fixture.Endpoint, GrpcChannelOptions.Empty); Assert.Same(channel1, channel2); } }
public void DifferentEndpoint_DifferentChannel() { var pool = new ChannelPool(ServiceMetadata); using (TestServiceFixture fixture1 = new TestServiceFixture(), fixture2 = new TestServiceFixture()) { var channel1 = pool.GetChannel(Grpc, fixture1.Endpoint, GrpcChannelOptions.Empty); var channel2 = pool.GetChannel(Grpc, fixture2.Endpoint, GrpcChannelOptions.Empty); Assert.NotSame(channel1, channel2); } }
public void DifferentEndpoint_DifferentChannel() { var pool = new ChannelPool(EmptyScopes); using (TestServiceFixture fixture1 = new TestServiceFixture(), fixture2 = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture1.Endpoint); var channel2 = pool.GetChannel(fixture2.Endpoint); Assert.NotSame(channel1, channel2); } }
public void SameEndpoint_SameChannel() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture.Endpoint); var channel2 = pool.GetChannel(fixture.Endpoint); Assert.Same(channel1, channel2); } }
public void ShutdownAsync_EmptiesPool() { var pool = new ChannelPool(ServiceMetadata); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(Grpc, fixture.Endpoint, GrpcChannelOptions.Empty); // Note: *not* waiting for this to complete. pool.ShutdownChannelsAsync(); var channel2 = pool.GetChannel(Grpc, fixture.Endpoint, GrpcChannelOptions.Empty); Assert.NotSame(channel1, channel2); } }
public async Task ShutdownAsync_ShutsDownChannel() { var pool = new ChannelPool(ServiceMetadata); using (var fixture = new TestServiceFixture()) { var channel = (Channel)pool.GetChannel(Grpc, fixture.Endpoint, GrpcChannelOptions.Empty); Assert.NotEqual(ChannelState.Shutdown, channel.State); await pool.ShutdownChannelsAsync(); Assert.Equal(ChannelState.Shutdown, channel.State); } }
public void DifferentOptions_DifferentChannel() { var options1 = GrpcChannelOptions.Empty.WithCustomOption("x", 5); var options2 = GrpcChannelOptions.Empty.WithCustomOption("x", 6); var pool = new ChannelPool(ServiceMetadata); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(Grpc, fixture.Endpoint, options1); var channel2 = pool.GetChannel(Grpc, fixture.Endpoint, options2); Assert.NotSame(channel1, channel2); } }
public void SameOptions_SameChannel() { var options1 = GrpcChannelOptions.Empty.WithCustomOption("x", 5); var options2 = GrpcChannelOptions.Empty.WithCustomOption("x", 5); var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(Grpc, fixture.Endpoint, options1); var channel2 = pool.GetChannel(Grpc, fixture.Endpoint, options2); Assert.Same(channel1, channel2); } }
public void ShutdownAsync_EmptiesPool() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture.Endpoint); // Note: *not* waiting for this to complete. pool.ShutdownChannelsAsync(); var channel2 = pool.GetChannel(fixture.Endpoint); Assert.NotSame(channel1, channel2); } }
public async Task ShutdownAsync_ShutsDownChannel() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel = pool.GetChannel(fixture.Endpoint); Assert.NotEqual(ChannelState.Shutdown, channel.State); await pool.ShutdownChannelsAsync(); Assert.Equal(ChannelState.Shutdown, channel.State); } }
public void DifferentOptions_DifferentChannel() { var options1 = new[] { new ChannelOption("x", 5) }; var options2 = new[] { new ChannelOption("x", 6) }; var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture.Endpoint, options1); var channel2 = pool.GetChannel(fixture.Endpoint, options2); Assert.NotSame(channel1, channel2); } }
public GrpcAdapterTest(TestServiceFixture fixture) => _fixture = fixture;
public GrpcNetClientAdapterTest(TestServiceFixture fixture) => _fixture = fixture;