public void VendingMachineItemToStringTest() { VendingMachineItem vendingMachineItemTest = new VendingMachineItem("A1", "Potato Crisps", 1.00M); string expected = string.Format("{0, 5} {1, 25} {2, 8:C}{3, 10}", "A1", "Potato Crisps", 1.00M, "5"); string result = vendingMachineItemTest.ToString(); Assert.AreEqual(expected, result); vendingMachineItemTest.InventoryCount = 0; expected = string.Format("{0, 5} {1, 25} {2, 8:C}{3, 10}", "A1", "Potato Crisps", 1.00M, "SOLD OUT"); result = vendingMachineItemTest.ToString(); Assert.AreEqual(expected, result); }
public void ToStringTest_True_Should_Return_Sold_Out() { item = new VendingMachineItem("Little League Chew", 0.95M, "D2"); item.PurchaseItem(); item.PurchaseItem(); item.PurchaseItem(); item.PurchaseItem(); item.PurchaseItem(); Assert.AreEqual("D2: SOLD OUT", item.ToString()); }
public void VendingMachineItemTestSOLDOUT() { VendingMachineItem vmi = new VendingMachineItem(); vmi.SlotLocation = "A1"; vmi.SnackName = "Chips"; vmi.Price = 3.05M; vmi.Count = 0; Assert.AreEqual("A1", vmi.SlotLocation); Assert.AreEqual("Chips", vmi.SnackName); Assert.AreEqual(3.05M, vmi.Price); Assert.AreEqual(0, vmi.Count); Assert.AreEqual("A1 - Chips - 3.05 , Quantity: SOLD OUT", vmi.ToString()); }
public void ToStringTest_False_Should_Return_Slot_Name_Quantity_Remaining_And_Price() { item = new VendingMachineItem("Little League Chew", 0.95M, "D2"); item.PurchaseItem(); item.PurchaseItem(); item.PurchaseItem(); item.PurchaseItem(); Assert.AreEqual("D2: Little League Chew 1 Remaining 0.95 ", item.ToString()); }