Ejemplo n.º 1
0
        public void TestCase1_CalculateSalesTax()
        {
            Product p1 = storeShelf.SearchAndRetrieveItemFromShelf("book", 12.49, false, 1);
            Product p2 = storeShelf.SearchAndRetrieveItemFromShelf("music cd", 14.99, false, 1);
            Product p3 = storeShelf.SearchAndRetrieveItemFromShelf("box of chocolates", 0.85, false, 1);

            shoppingCartObj.AddItemToCart(p1);
            shoppingCartObj.AddItemToCart(p2);
            shoppingCartObj.AddItemToCart(p3);

            List <Product> productList = shoppingCartObj.GetItemsFromCart();

            biller.CalcSalesTax(productList);
            double totalTax    = biller.CalcTotalTax(productList);
            double totalAmount = biller.CalcTotalAmount(productList);

            Assert.AreEqual(1.50d, totalTax);
            Assert.AreEqual(29.83d, totalAmount);
        }
Ejemplo n.º 2
0
        public void CheckOutAndPrintReceipt()
        {
            List <Product> productList = shoppingCartObj.GetItemsFromCart();

            biller.CalcSalesTax(productList);

            double totalTax = biller.CalcTotalTax(productList);

            double totalAmount = biller.CalcTotalAmount(productList);

            Receipt receipt = new Receipt(productList, totalTax, totalAmount);

            PrintReceipt(receipt);
        }