public void overloaded_calls_should_throw_exception() { var agent1 = new Agent("A1"); var agent2 = new Agent("A2"); var agents = new ConcurrentQueue<Agent>(new[] { agent1, agent2 }); var loadBalancer = new LoadBalancer(); loadBalancer.AssignInteraction(new CallInteraction("12345"), agents); loadBalancer.AssignInteraction(new CallInteraction("23456"), agents); loadBalancer.AssignInteraction(new CallInteraction("34567"), agents); }
public void interactions_should_be_added_to_agents() { var agent1 = new Agent("A1"); var agent2 = new Agent("A2"); var call = new CallInteraction("12345"); var email = new EmailInteraction("*****@*****.**"); var agents = new ConcurrentQueue<Agent>(new [] {agent1, agent2}); var loadBalancer = new LoadBalancer(); var callAgent = loadBalancer.AssignInteraction(call, agents); var emailAgent = loadBalancer.AssignInteraction(email, agents); callAgent.Should().Be(agent1); callAgent.Calls.Count.Should().Be(1); callAgent.Calls.First().Should().Be(call); emailAgent.Should().Be(agent2); emailAgent.Emails.Count.Should().Be(1); emailAgent.Emails.First().Should().Be(email); }
public void adding_interactions_should_be_balanced_between_agents() { var agent1 = new Agent("A1"); var agent2 = new Agent("A2"); var agents = new ConcurrentQueue<Agent>(new[] { agent1, agent2 }); var loadBalancer = new LoadBalancer(); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); agent1.Emails.Count.Should().Be(5); agent2.Emails.Count.Should().Be(4); }
public void overloaded_emails_should_throw_exception() { var agent1 = new Agent("A1"); var agent2 = new Agent("A2"); var agents = new ConcurrentQueue<Agent>(new[] { agent1, agent2 }); var loadBalancer = new LoadBalancer(); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); loadBalancer.AssignInteraction(new EmailInteraction("*****@*****.**"), agents); }