public void testFoodItemTypes() { FoodTypeService fts = new FoodTypeService(); GrocItem giFood = new GrocItem("Burger", fts); GrocItem giNonFood = new GrocItem("Light Bulb", fts); Assert.AreEqual(FoodType.FOOD, giFood.ItemFoodType); Assert.AreEqual(FoodType.NONFOOD, giNonFood.ItemFoodType); }
public void testFinalSummaryOutput() { PriceService ps = new PriceService(); CashRegister cr = new CashRegister(ps); FoodTypeService fts = new FoodTypeService(); String desiredOut = "Food Items: 2 NonFood Items: 1 Food Tax: 0.24 " + "NonFood Tax: 0.14 Subtotal: 9.98 Order Total: 10.36"; GrocItem giFood1 = new GrocItem("Burger", fts); GrocItem giFood2 = new GrocItem("Bread", fts); GrocItem giNonFood = new GrocItem("Light Bulb", fts); cr.AddItem(giFood1); cr.AddItem(giFood2); cr.AddItem(giNonFood); String receipt = cr.PrintFinalTotals(); Assert.AreEqual(desiredOut, receipt); }
public GrocItem(string ItemName, FoodTypeService fts) { this.ItemName = ItemName; this.ItemFoodType = fts.DetermineFoodType(this.ItemName); }