Beispiel #1
0
        public void BusyAttendantsAreNotSuitableForAssignment()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            var busy = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            callCenter.AddAttendant("Fred", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            var chosen = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            chosen.Should().Be("Fred");

            callCenter.GetBusyAttendants().Should().Contain("Bob", "Fred");
        }
Beispiel #2
0
        public void CanAddAttendant()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new [] { "English", "French" }, new [] { "Plumbing", "Fishing" });

            callCenter.GetAttendants().Should().Contain("Bob");
        }
Beispiel #3
0
        public void MarkingAvailableAttendantAvailableHasNoEffect()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            callCenter.SetAttendantAvailable("Bob").Should().BeFalse();

            callCenter.GetBusyAttendants().Should().BeEmpty();
        }
Beispiel #4
0
        public void RemovedAttendantsCannotBeSelected()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });
            callCenter.RemoveAttendant("Bob");

            var chosen = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            chosen.Should().BeNull();
        }
Beispiel #5
0
        public void WhenNoSuitableAttendantNoneAssigned()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            var chosen = callCenter.AssignAttendant(new[] { "French" }, new[] { "Knitting" });

            chosen.Should().BeNull();

            callCenter.GetBusyAttendants().Should().BeEmpty();
        }
Beispiel #6
0
        public void CanSetBusyAttendantAvailable()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            var busy = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            callCenter.SetAttendantAvailable(busy).Should().BeTrue();

            callCenter.GetBusyAttendants().Should().BeEmpty();
        }
Beispiel #7
0
        public void WhenOnlySuitableCandidatesAreBusyNoneIsSelected()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            var busy = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            var chosen = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            chosen.Should().BeNull();

            callCenter.GetBusyAttendants().Should().Contain("Bob");
        }
Beispiel #8
0
        public void BusyAttendantsSetAvailableCanBeSelectedAgain()
        {
            var callCenter = new CallCenter("localhost", RedisSetUp.Port);

            callCenter.Flush();

            callCenter.AddAttendant("Bob", new[] { "English", "French" }, new[] { "Plumbing", "Fishing" });

            callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });
            callCenter.SetAttendantAvailable("Bob");

            var busy = callCenter.AssignAttendant(new[] { "French" }, new[] { "Fishing" });

            busy.Should().Be("Bob");

            callCenter.GetBusyAttendants().Should().Contain("Bob");
        }