public async Task DynamicEnvironmentClusterClient_should_reuse_existing_cluster_client_for_each_environment() { var environmentStorage = new EnvironmentStorage("e1", "e2"); var receivedEnvironments = new List <string>(); var client = new DynamicEnvironmentClusterClient( new SynchronousConsoleLog(), () => environmentStorage.Next(), GetClusterClientSetupProvider(env => receivedEnvironments.Add(env))); for (var i = 0; i < 5; i++) { await client.SendAsync(Request); } receivedEnvironments.Should().BeEquivalentTo(environmentStorage.Environments); }
public async Task DynamicEnvironmentClusterClient_should_create_new_cluster_client_for_each_environment() { var actualCallCount = 0; var expectedCallCount = 5; var receivedEnvironments = new List <string>(); var client = new DynamicEnvironmentClusterClient( new SynchronousConsoleLog(), () => actualCallCount++.ToString(), GetClusterClientSetupProvider(env => receivedEnvironments.Add(env))); for (var i = 0; i < expectedCallCount; i++) { await client.SendAsync(Request); } actualCallCount.Should().Be(expectedCallCount); receivedEnvironments.Should().BeEquivalentTo(Enumerable.Range(0, expectedCallCount).Select(i => i.ToString())); }