Exemple #1
0
        public void ShouldReceiveTheSameAmountDeposited()
        {
            ui.PerformAction(MainMenu.Commands.AddMoney + " 1.25");
            string result = ui.PerformAction(MainMenu.Commands.ReturnChange.Command);

            Assert.IsTrue(result.Contains("1.25"));
        }
Exemple #2
0
        public void ShouldDisplayMachineBalance()
        {
            machine.DepositMachineMoney(5);
            string result = ui.PerformAction(AdminMenu.Commands.ViewMachineBalance.Command);

            Assert.IsTrue(result.Contains("$5.00"));
        }
 public void ShouldPrintCorrectCustomerBalance()
 {
     SodaMachine machine = new SodaMachine(10);
     SodaMachineUi machineUi = new SodaMachineUi(machine);
     machine.DepositCustomerMoney(2.25);
     string result = machineUi.PerformAction(MainMenu.Commands.PrintCustomerBalance.Command).ToString();
     Assert.IsTrue(result.Contains("2.25"), string.Format("Result should contain 2.25, actual result was {0}", result));
 }
Exemple #4
0
        public void ShouldPrintCorrectCustomerBalance()
        {
            SodaMachine   machine   = new SodaMachine(10);
            SodaMachineUi machineUi = new SodaMachineUi(machine);

            machine.DepositCustomerMoney(2.25);
            string result = machineUi.PerformAction(MainMenu.Commands.PrintCustomerBalance.Command).ToString();

            Assert.IsTrue(result.Contains("2.25"), string.Format("Result should contain 2.25, actual result was {0}", result));
        }
Exemple #5
0
        public void ShouldRenderProductList()
        {
            machine.Slots[2].ProductName = "Dr. Pepper";
            machine.Slots[3].ProductName = "Coca Cola";
            string result = ui.PerformAction(MainMenu.Commands.ViewProductList.Command);

            string[] lines = result.Split('\n');
            Assert.IsTrue(lines[2].Contains("3"));
            Assert.IsTrue(lines[2].Contains("Dr. Pepper"));
            Assert.IsTrue(lines[3].Contains("4"));
            Assert.IsTrue(lines[3].Contains("Coca Cola"));
        }
Exemple #6
0
        public void ShouldRenderViewInventory()
        {
            machine.Slots[2].ProductName = "Dr. Pepper";
            machine.Slots[2].Quantity    = 9;
            machine.Slots[3].ProductName = "Coca Cola";
            machine.Slots[3].Quantity    = 11;
            string result = ui.PerformAction(AdminMenu.Commands.ViewInventory.Command).ToString();

            string[] lines = result.Split('\n');
            Assert.IsTrue(lines[2].Contains("3"));
            Assert.IsTrue(lines[2].Contains("9"));
            Assert.IsTrue(lines[2].Contains("Dr. Pepper"));
            Assert.IsTrue(lines[3].Contains("4"));
            Assert.IsTrue(lines[3].Contains("11"));
            Assert.IsTrue(lines[3].Contains("Coca Cola"));
        }
 public void SetUp()
 {
     machine = new SodaMachine(10);
     ui = new SodaMachineUi(machine);
     ui.PerformAction(MainMenu.Commands.StockerMenu.Command);
 }
Exemple #8
0
 public void ShouldBeAbleToNameAnItem()
 {
     ui.PerformAction(AdminMenu.Commands.NameItems.Command + " 1 Coca Cola");
     Assert.AreEqual("Coca Cola", machine.Slots[0].ProductName);
 }
Exemple #9
0
 public void SetUp()
 {
     machine = new SodaMachine(10);
     ui      = new SodaMachineUi(machine);
     ui.PerformAction(MainMenu.Commands.StockerMenu.Command);
 }
Exemple #10
0
        public void ShouldUpdateCustomerBalance()
        {
            ui.PerformAction(MainMenu.Commands.AddMoney + " " + "1.25");

            Assert.AreEqual(1.25, machine.CustomerBalance);
        }
Exemple #11
0
 public void ShouldDisplaySubMenu()
 {
     ui.PerformAction(MainMenu.Commands.StockerMenu.Command);
     Assert.IsInstanceOfType(ui.ActiveController, typeof(AdminMenu));
 }
Exemple #12
0
 public void ShouldBeAbleToAddItems()
 {
     ui.PerformAction(AdminMenu.Commands.AdjustQuantity.Command + " 1 1");
     Assert.AreEqual(1, machine.Slots[0].Quantity);
 }
Exemple #13
0
 public void ShouldBeAbleToSelectAnItem()
 {
     machine.DepositCustomerMoney(2);
     ui.PerformAction(MainMenu.Commands.ChooseItem.Command + " 1");
     Assert.AreEqual(9, machine.Slots[0].Quantity);
 }