public void ShouldInjectInFront() { // Given var table = new RoundRobinRoutingTable( CreateUriArray(3), CreateUriArray(0), CreateUriArray(0), new Stopwatch(), 5 * 60); Uri router; table.TryNextRouter(out router); var head = new Uri("http://neo4j:10"); router.Should().Be(head); // When var first = new Uri("me://12"); var second = new Uri("me://22"); table.PrependRouters(new List <Uri> { first, second }); // Then table.TryNextRouter(out router); router.Should().Be(first); table.TryNextRouter(out router); router.Should().Be(second); table.TryNextRouter(out router); router.Should().Be(head); }
[InlineData(1, 2, 1, -1, true)] // expire immediately public void ShouldBeStaleInWriteModeIfOnlyHaveOneRouter(int routerCount, int readerCount, int writerCount, long expireAfterSeconds, bool isStale) { var table = new RoundRobinRoutingTable( CreateUriArray(routerCount), CreateUriArray(readerCount), CreateUriArray(writerCount), new Stopwatch(), expireAfterSeconds); table.IsStale(AccessMode.Write).Should().Be(isStale); }