Exemple #1
0
        public void ShouldSelectARandomEndpoint()
        {
            var order = new[] { 3, 4, 2, 0, 1 };
            var rand  = new NotReallyRandom(order);
            var sut   = CreateSut(new RoutingStrategyRandom(rand), Endpoints);

            foreach (var offset in order)
            {
                var expected = Endpoints[offset];

                var result = sut.GetEndpointUrl();
                result.Should().NotBeNull();
                result.ToString()
                .Should()
                .Be(expected.Uri.ToString());
            }
        }
        public void ShouldSelectARandomEndpoint()
        {
            var order = new[] {3, 4, 2, 0, 1};
            var rand = new NotReallyRandom(order);
            var sut = CreateSut(new RoutingStrategyRandom(rand), Endpoints);

            foreach (var offset in order)
            {
                var expected = Endpoints[offset];

                var result = sut.GetEndpointUrl();
                result.Should().NotBeNull();
                result.ToString()
                      .Should()
                      .BeSameAs(expected.Uri.ToString());
            }
        }