Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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())
                );
        }