示例#1
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);
        }
示例#2
0
 public CashRegister(PriceService p)
 {
     this._priceService = p;
 }