Ejemplo n.º 1
0
        public void TestBChoosingEmptyLine()
        {
            var c1 = new Cashier(1);
            c1.EnqueueCustomer(new CustomerA(0, 10));

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

            var t = new CashierTrainee(3);

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

            var b = new CustomerB(1, 10);
            var chosenCashier = b.ChooseCashier(cashiers);
            ;
            Assert.AreEqual(t, chosenCashier);
        }
Ejemplo n.º 2
0
        public void TestBChoosingLineWithFewestItemsLeftForLastPerson()
        {
            var c1 = new CashierTrainee(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 Cashier(3);
            c3.EnqueueCustomer(new CustomerA(1, 18));

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

            var c = new CustomerB(4, 999);
            var chosenCashier = c.ChooseCashier(cashiers);
            Assert.AreEqual(c1, chosenCashier);
        }