public void DisplayResetsToCeditAmountOnDisplayCheckAfterSoldOutIfMoneyIsInMachineTest()
        {
            var soda  = new ProductType(1, "Soda", 1.00M, 3);
            var chips = new ProductType(2, "Chips", .5M, 2);
            var candy = new ProductType(3, "Candy", .65M, 5);

            VendingMachine = new VendingMachineViewModel(new List <ProductType>()
            {
                soda, chips, candy
            }, 50, 50, 50);
            var display = VendingMachine.CheckDisplay();

            VendingMachine.ButtonPressed(2);
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");

            VendingMachine.ButtonPressed(2);
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");

            // chips should now be sold out
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.ButtonPressed(2);
            display = VendingMachine.CheckDisplay();
            Assert.AreEqual(display, "SOLD OUT");
            display = VendingMachine.CheckDisplay();
            Assert.AreEqual(display, "$0.50");
        }
        public void ItemSelectedByCustomerIsSoldOutDisplaySoldOutTest()
        {
            var soda  = new ProductType(1, "Soda", 1.00M, 3);
            var chips = new ProductType(2, "Chips", .5M, 2);
            var candy = new ProductType(3, "Candy", .65M, 5);

            VendingMachine = new VendingMachineViewModel(new List <ProductType>()
            {
                soda, chips, candy
            }, 50, 50, 50);
            var display = VendingMachine.CheckDisplay();

            VendingMachine.ButtonPressed(2);
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");

            VendingMachine.ButtonPressed(2);
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");

            // chips should now be sold out
            VendingMachine.ButtonPressed(2);
            display = VendingMachine.CheckDisplay();
            Assert.AreEqual(display, "SOLD OUT");
        }
        public void DisplayExactChangeOnlyWHenMachineIsLowOnChangeToReturnAfterItemPurchaseTest()
        {
            var soda  = new ProductType(1, "Soda", 1.00M, 3);
            var chips = new ProductType(2, "Chips", .5M, 2);
            var candy = new ProductType(3, "Candy", .65M, 5);

            VendingMachine = new VendingMachineViewModel(new List <ProductType>()
            {
                soda, chips, candy
            }, 3, 3, 3);
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.InsertCoin("Quarter");
            VendingMachine.ButtonPressed(3);

            var display = VendingMachine.CheckDisplay();

            Assert.AreEqual(display, "EXACT CHANGE ONLY");
        }
 public void ProductSelectedTest()
 {
     VendingMachine.ButtonPressed(1);
     Assert.AreEqual(VendingMachine.SelectedProduct.ButtonNumber, 1);
 }