public async Task TestServiceConnectionContainerWithSomeThrows2WriteWithPartitionCanPass() { var container = new TestServiceConnectionContainer(new List <IServiceConnection> { new TestServiceConnection(), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), }); await container.WriteAsync(new HandshakeResponseMessage()); await container.WriteAsync("1", new HandshakeResponseMessage()); }
public async Task TestServiceConnectionContainerWithAllConnectedSucceeeds() { var container = new TestServiceConnectionContainer(new List <IServiceConnection> { new TestServiceConnection(), new TestServiceConnection(), new TestServiceConnection(), new TestServiceConnection(), new TestServiceConnection(), new TestServiceConnection(), new TestServiceConnection(), }); await container.WriteAsync(new HandshakeResponseMessage()); await container.WriteAsync("1", new HandshakeResponseMessage()); }
public async Task TestServiceConnectionContainerWithAllThrowsThrows() { var container = new TestServiceConnectionContainer(new List <IServiceConnection> { new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), new TestServiceConnection(throws: true), }); await Assert.ThrowsAsync <ServiceConnectionNotActiveException>( () => container.WriteAsync(new HandshakeResponseMessage()) ); await Assert.ThrowsAsync <ServiceConnectionNotActiveException>( () => container.WriteAsync("1", new HandshakeResponseMessage()) ); }