public void DifferentEndpoint_DifferentCallInvoker() { var pool = new GcpCallInvokerPool(TestServiceMetadata.TestService); var options = GrpcChannelOptions.Empty.WithPrimaryUserAgent("abc"); var callInvoker1 = pool.GetCallInvoker("endpoint1", options, Config1, FakeAdapter); var callInvoker2 = pool.GetCallInvoker("endpoint2", options, Config1, FakeAdapter); Assert.NotSame(callInvoker1, callInvoker2); }
public void SameEndpointAndEqualOptions_SameCallInvoker() { var pool = new GcpCallInvokerPool(TestServiceMetadata.TestService); var options1 = GrpcChannelOptions.Empty.WithPrimaryUserAgent("abc"); var options2 = GrpcChannelOptions.Empty.WithPrimaryUserAgent("abc"); var callInvoker1 = pool.GetCallInvoker("endpoint", options1, Config1, FakeAdapter); var callInvoker2 = pool.GetCallInvoker("endpoint", options2, Config1, FakeAdapter); Assert.Same(callInvoker1, callInvoker2); }
public void ShutdownAsync_EmptiesPool() { var pool = new GcpCallInvokerPool(TestServiceMetadata.TestService); var callInvoker1 = pool.GetCallInvoker("endpoint", options: null, Config1, FakeAdapter); // Note: *not* waiting for this to complete. pool.ShutdownChannelsAsync(); var callInvoker2 = pool.GetCallInvoker("endpoint", options: null, Config1, FakeAdapter); Assert.NotSame(callInvoker1, callInvoker2); }
public void DifferentEndpoint_DifferentCallInvoker() { var pool = new GcpCallInvokerPool(EmptyScopes); var options = new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "abc") }; using (TestServiceFixture fixture1 = new TestServiceFixture(), fixture2 = new TestServiceFixture()) { var callInvoker1 = pool.GetCallInvoker(fixture1.Endpoint, options); var callInvoker2 = pool.GetCallInvoker(fixture2.Endpoint, options); Assert.NotSame(callInvoker1, callInvoker2); } }
public void SameEndpointAndOptions_SameCallInvoker() { var pool = new GcpCallInvokerPool(EmptyScopes); var options = new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "abc") }; using (var fixture = new TestServiceFixture()) { var callInvoker1 = pool.GetCallInvoker(fixture.Endpoint, options); var callInvoker2 = pool.GetCallInvoker(fixture.Endpoint, options); Assert.Same(callInvoker1, callInvoker2); } }
public void ShutdownAsync_EmptiesPool() { var pool = new GcpCallInvokerPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var callInvoker1 = pool.GetCallInvoker(fixture.Endpoint); // Note: *not* waiting for this to complete. pool.ShutdownChannelsAsync(); var callInvoker2 = pool.GetCallInvoker(fixture.Endpoint); Assert.NotSame(callInvoker1, callInvoker2); } }
public void SameEndpointAndEqualOptions_SameCallInvoker() { var pool = new GcpCallInvokerPool(EmptyScopes); var options1 = GrpcChannelOptions.Empty.WithPrimaryUserAgent("abc"); var options2 = GrpcChannelOptions.Empty.WithPrimaryUserAgent("abc"); using (var fixture = new TestServiceFixture()) { var callInvoker1 = pool.GetCallInvoker(fixture.Endpoint, options1); var callInvoker2 = pool.GetCallInvoker(fixture.Endpoint, options2); Assert.Same(callInvoker1, callInvoker2); } }
public void DifferentOptions_DifferentCallInvoker() { var pool = new GcpCallInvokerPool(EmptyScopes); var options1 = new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "abc") }; var options2 = new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "def") }; using (var fixture = new TestServiceFixture()) { var callInvoker1 = pool.GetCallInvoker(fixture.Endpoint, options1); var callInvoker2 = pool.GetCallInvoker(fixture.Endpoint, options2); Assert.NotSame(callInvoker1, callInvoker2); var callInvoker3 = pool.GetCallInvoker(fixture.Endpoint); Assert.NotSame(callInvoker1, callInvoker3); } }