Inheritance: IEndpointResolver
        public void SelectOneShouldReturnFoundEndpoint()
        {
            var ep = new TestEndpointResolver(new List <AmqpTcpEndpoint> {
                new AmqpTcpEndpoint()
            });

            Assert.NotNull(ep.SelectOne((e) => e));
        }
Exemplo n.º 2
0
        public void SelectOneShouldRaiseThrownExceptionWhenThereAreOnlyInaccessibleEndpoints()
        {
            var ep = new TestEndpointResolver(new List <AmqpTcpEndpoint> {
                new AmqpTcpEndpoint()
            });

            Assert.Throws <TestEndpointException>(() => ep.SelectOne <AmqpTcpEndpoint>((x) => { throw new TestEndpointException("bananas"); }));
        }
        public void SelectOneShouldRaiseThrownExceptionWhenThereAreOnlyInaccessibleEndpoints()
        {
            var ep = new TestEndpointResolver(new List <AmqpTcpEndpoint> {
                new AmqpTcpEndpoint()
            });
            AggregateException thrown = Assert.Throws <AggregateException>(() => ep.SelectOne <AmqpTcpEndpoint>((x) => { throw new TestEndpointException("bananas"); }));

            Assert.That(thrown.InnerExceptions, Has.Exactly(1).TypeOf <TestEndpointException>());
        }
        public void SelectOneShouldRaiseThrownExceptionWhenThereAreOnlyInaccessibleEndpoints()
        {
            var ep = new TestEndpointResolver(new List <AmqpTcpEndpoint> {
                new AmqpTcpEndpoint()
            });
            AggregateException thrown = Assert.Throws <AggregateException>(() => ep.SelectOne <AmqpTcpEndpoint>((x) => { throw new TestEndpointException("bananas"); }));

            Assert.Single(thrown.InnerExceptions);
            Assert.All(thrown.InnerExceptions, e => Assert.IsType <TestEndpointException>(e));
        }
        public void SelectOneShouldReturnDefaultWhenThereAreNoEndpoints()
        {
            var ep = new TestEndpointResolver(new List <AmqpTcpEndpoint>());

            Assert.Null(ep.SelectOne <AmqpTcpEndpoint>((x) => null));
        }
 public void SelectOneShouldReturnFoundEndpoint()
 {
     var ep = new TestEndpointResolver(new List<AmqpTcpEndpoint> { new AmqpTcpEndpoint()});
     Assert.IsNotNull(ep.SelectOne<AmqpTcpEndpoint>((e) => e));
 }
 public void SelectOneShouldReturnDefaultWhenThereAreNoEndpoints()
 {
     var ep = new TestEndpointResolver(new List<AmqpTcpEndpoint>());
     Assert.IsNull(ep.SelectOne<AmqpTcpEndpoint>((x) => null));
 }
 public void SelectOneShouldRaiseThrownExceptionWhenThereAreOnlyInaccessibleEndpoints()
 {
     var ep = new TestEndpointResolver(new List<AmqpTcpEndpoint> { new AmqpTcpEndpoint()});
     Assert.Throws<TestEndpointException>(() => ep.SelectOne<AmqpTcpEndpoint>((x) => { throw new TestEndpointException("bananas"); }));
 }