public async Task TestContainerWithOneEndpointWithAllDisconnectedAndConnectionStartedThrows() { var sem = new TestServiceEndpointManager(new ServiceEndpoint(ConnectionString1)); var throws = new ServiceConnectionNotActiveException(); var router = new TestEndpointRouter(throws); var container = new MultiEndpointServiceConnectionContainer( e => new TestBaseServiceConnectionContainer(new List <IServiceConnection> { new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), new TestServiceConnection(ServiceConnectionStatus.Disconnected), }, e), sem, router, null); await Assert.ThrowsAsync(throws.GetType(), () => container.WriteAsync(DefaultGroupMessage) ); await Assert.ThrowsAsync(throws.GetType(), () => container.WriteAsync("1", DefaultGroupMessage) ); }
public async Task TestContainerWithBadRouterThrows() { var sem = new TestServiceEndpointManager(new ServiceEndpoint(ConnectionString1)); var throws = new ServiceConnectionNotActiveException(); var router = new TestEndpointRouter(throws); var container = new MultiEndpointServiceConnectionContainer("hub", e => new TestBaseServiceConnectionContainer(new List <IServiceConnection> { new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), new TestSimpleServiceConnection(ServiceConnectionStatus.Disconnected), }, e), sem, router, null); // All the connections started _ = container.StartAsync(); await container.ConnectionInitializedTask; await Assert.ThrowsAsync(throws.GetType(), () => container.WriteAsync(DefaultGroupMessage) ); }