Ejemplo n.º 1
0
        public void TestAChoosingShortestLine()
        {
            var c1 = new Cashier(1);
            c1.EnqueueCustomer(new CustomerA(1, 10));
            c1.EnqueueCustomer(new CustomerB(2, 100));
            c1.EnqueueCustomer(new CustomerA(3, 8));

            var c2 = new Cashier(2);
            c2.EnqueueCustomer(new CustomerB(2, 10));
            c2.EnqueueCustomer(new CustomerB(2, 15));

            var c3 = new CashierTrainee(3);
            c3.EnqueueCustomer(new CustomerA(1, 9999));

            var cashiers = new HashSet<ICashier> {c1, c2, c3};

            var c = new CustomerA(3, 1);
            var chosenCashier = c.ChooseCashier(cashiers);
            Assert.AreEqual(c3, chosenCashier);
        }
Ejemplo n.º 2
0
        public void TestNullCashiers()
        {
            var noCashiers = new HashSet<ICashier>();

            var custA = new CustomerA(1, 10);
            var chosenA = custA.ChooseCashier(noCashiers);
            Assert.IsNull(chosenA);

            var custB = new CustomerA(1, 10);
            var chosenB = custB.ChooseCashier(noCashiers);
            Assert.IsNull(chosenB);
        }