示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public GrocItem(string ItemName, FoodTypeService fts)
 {
     this.ItemName = ItemName;
     this.ItemFoodType = fts.DetermineFoodType(this.ItemName);
 }