public void FeedMoneyTest() { VendMachine testVendMachine = new VendMachine(); testVendMachine.LoadInventory(); Assert.AreEqual(0, testVendMachine.CurrentBalance); testVendMachine.FeedMoney(50); Assert.AreEqual(50, testVendMachine.CurrentBalance); }
public void PurchaseAnItemTest() { VendMachine testVendMachine = new VendMachine(); testVendMachine.LoadInventory(); testVendMachine.FeedMoney(10); testVendMachine.PurchaseAProduct("A1"); Assert.AreEqual(4, testVendMachine.ItemsStocked["A1"].ProductQuantity); Assert.AreEqual(6.95, testVendMachine.CurrentBalance); }
public void LoadInventoryTest() { VendMachine testVendMachine = new VendMachine(); testVendMachine.LoadInventory(); Assert.AreEqual("Potato Crisps", testVendMachine.ItemsStocked["A1"].ProductName); Assert.AreEqual("Grain Waves", testVendMachine.ItemsStocked["A3"].ProductName); Assert.AreEqual(1.80, testVendMachine.ItemsStocked["B1"].ProductPrice); Assert.AreEqual(5, testVendMachine.ItemsStocked["C1"].ProductQuantity); }
static void Main(string[] args) { Console.Clear(); VendMachine vm = new VendMachine(true); VendMachine vm2 = new VendMachine(false); bool inVend = true; while (inVend) { vm.PrintContents(); System.Console.WriteLine("Press a number to chose an item or 'd' to deposit money"); string choice = Console.ReadLine().ToLower(); if (choice == "d") { System.Console.Write("Enter an amount: "); string amount = Console.ReadLine(); vm.AddMoney(amount); continue; } vm.Vend(choice); } }
public static void Main(string[] args) { VendMachine newVendingMachine = new VendMachine(); Menus runningMenus = new Menus(newVendingMachine); VendingMachineCLI runningMachine = new VendingMachineCLI(newVendingMachine, runningMenus); }