public void RegisterShouldNotHaveCustomersWhenSufficientTimeHasPassedToProcessItem()
 {
     Register register = new Register(1);
     Customer customer = new Customer(new ShorterLineStrategy(), Customer.TypeAPriorityLevel, 1, 1);
     register.AddCustomerToLine(customer);
     Assert.IsTrue(register.HasCustomers);
     register.ProcessOneMinute();
     Assert.IsFalse(register.HasCustomers);
 }
        public Register GetBetterRegister(Register register1, Register register2)
        {
            if (!register1.HasCustomers) return register1;
            if (!register2.HasCustomers) return register2;

            if (register1.LastCustomerInLine.NumberOfItems <= register2.LastCustomerInLine.NumberOfItems)
                return register1;

            return register2;
        }
        public void SecondRegisterShouldBeReturnedWhenItHasTheShorterLine()
        {
            Register register1 = new Register(1);
            register1.AddCustomerToLine(_testHelper.GetDefaultCustomer());

            Register register2 = new Register(1);

            Register betterRegister = _shorterLineStrategy.GetBetterRegister(register1, register2);

            Assert.AreEqual(register2, betterRegister);
        }
        public void LastCustomerInLineShouldReturnTheMostRecentCustomerAdded()
        {
            Register register = new Register(1);
            Customer customer1 = new Customer(new ShorterLineStrategy(), Customer.TypeAPriorityLevel, 1, 1);
            Customer customer2 = new Customer(new ShorterLineStrategy(), Customer.TypeAPriorityLevel, 1, 1);

            register.AddCustomerToLine(customer1);

            Assert.AreEqual(customer1, register.LastCustomerInLine);

            register.AddCustomerToLine(customer2);

            Assert.AreEqual(customer2, register.LastCustomerInLine);
        }
        public Register GetBetterRegister(Register register1, Register register2)
        {
            if (register1.CustomersInLine <= register2.CustomersInLine) return register1;

            return register2;
        }
 public void HasCustomersShouldBeTrueWhenACustomerHasJustBeenAdded()
 {
     Register register = new Register(1);
     register.AddCustomerToLine(new Customer(new ShorterLineStrategy(), Customer.TypeAPriorityLevel, 1, 1));
     Assert.IsTrue(register.HasCustomers);
 }
 public void HasCustomersShouldBeFalseWhenNoCustomersHaveBeenAdded()
 {
     Register register = new Register(1);
     Assert.IsFalse(register.HasCustomers);
 }
 public void SetUp()
 {
     _register1 = new Register(1);
     _register2 = new Register(1);
 }