public void CanRackIsFullTest() { int maxInventory = 5; var cr = new CanRack(maxInventory); foreach (Flavor f in Enum.GetValues(typeof(Flavor))) { for (int i = 1; i <= maxInventory + 2; i++) { cr.AddACanOf(f); // While amount < maxInventory rack is not full if (i < maxInventory) { Assert.IsFalse(cr.IsFull(f)); } else { Assert.IsTrue(cr.IsFull(f)); } } } }
public void CanRackAddACanOfTest() { int maxInventory = 6; var cr = new CanRack(maxInventory); // Attempt to add 3 more cans than the maximum allowed foreach (Flavor f in Enum.GetValues(typeof(Flavor))) { for (int i = 1; i <= maxInventory + 3; i++) { cr.AddACanOf(f); // Check the cans are incrementing up to the max inventory, but not over if (i <= maxInventory) { Assert.AreEqual(cr.Contents(f).Amount, i); } else { Assert.AreNotEqual(cr.Contents(f).Amount, i); } } } }