public void Can_Report_Pantry_Is_Empty() { const string EMPTY_PANTRY_MESSAGE = "The Pantry is bare!"; Pantry pantry = new Pantry(); CollectionAssert.IsEmpty(pantry.Items, "PRECONDITION ASSERT FAILURE: pantry.Items is NOT empty as expected!"); Assert.AreEqual(EMPTY_PANTRY_MESSAGE.ToUpper(), pantry.ReportOnItems().ToUpper()); }
public void Can_Report_Items_as_Expected() { const string ITEM1_DESCRIPTION = "sugar"; const int ITEM1_QUANTITY = 3; const string ITEM2_DESCRIPTION = "flour"; const int ITEM2_QUANTITY = 1; Pantry pantry = new Pantry(); Item sugar = new Item() { Description = ITEM1_DESCRIPTION }; sugar.AssignQuantity(ITEM1_QUANTITY); Item flour = new Item() { Description = ITEM2_DESCRIPTION }; flour.AssignQuantity(ITEM2_QUANTITY); pantry.AddItem(sugar); pantry.AddItem(flour); string itemsReport = pantry.ReportOnItems(); Assert.AreEqual(string.Format("{0}: {1}\r\n{2}: {3}\r\n", ITEM1_DESCRIPTION, ITEM1_QUANTITY, ITEM2_DESCRIPTION, ITEM2_QUANTITY), itemsReport); }