public void DisplayResetsToInsertCoinOnDisplayCheckAfterSoldOutIfNoMoneyIsInMachineTest() { 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"); display = VendingMachine.CheckDisplay(); Assert.AreEqual(display, INSERT_COIN); }
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 InsertValidCoinTest() { var initCredit = VendingMachine.CreditValue; VendingMachine.InsertCoin("Quarter"); Assert.AreNotEqual(initCredit, VendingMachine.CreditValue); initCredit = VendingMachine.CreditValue; VendingMachine.InsertCoin("Dime"); Assert.AreNotEqual(initCredit, VendingMachine.CreditValue); initCredit = VendingMachine.CreditValue; VendingMachine.InsertCoin("Nickle"); Assert.AreNotEqual(initCredit, VendingMachine.CreditValue); }
public void Execute(object parameter) { vm.InsertCoin(); }