Ejemplo n.º 1
0
            public static bool TestAllImportedGoods(string[] exemptedFood, string[] exemptedBooks, string[] exemptedMedProducts)
            {
                CashRegister register = new CashRegister(exemptedFood, exemptedBooks, exemptedMedProducts);

                List <DetailedGood> basket = new List <DetailedGood>();

                basket.Add(new DetailedGood("imported box of chocolates", true, 8));
                basket.Add(new DetailedGood("imported bottle of perfume", true, 40));
                basket.Add(new DetailedGood("imported bottle of perfume", true, 40));
                basket.Add(new DetailedGood("box of imported chocolates", true, 8));

                register.ScanShoppingBasket(basket);
                Receipt        receipt = register.GetReceipt();
                ReceiptDetails details = receipt.CalculateReceiptDetails();

                return(details.GoodsDetails.Count == 3 && details.SalesTax == 12.8 && details.TotalCost == 108.8);
            }
Ejemplo n.º 2
0
            private static bool TestAllNotImportedGoods(string[] exemptedFood, string[] exemptedBooks, string[] exemptedMedProducts)
            {
                CashRegister register = new CashRegister(exemptedFood, exemptedBooks, exemptedMedProducts);

                List <DetailedGood> basket = new List <DetailedGood>();

                basket.Add(new DetailedGood("book", false, 15));
                basket.Add(new DetailedGood("music CD", false, 15));
                basket.Add(new DetailedGood("chocolate bar", false, 5));
                basket.Add(new DetailedGood("bottle of perfume", false, 25));
                basket.Add(new DetailedGood("packet of headache pills", false, 8));

                register.ScanShoppingBasket(basket);
                Receipt        receipt = register.GetReceipt();
                ReceiptDetails details = receipt.CalculateReceiptDetails();

                return(details.GoodsDetails.Count == 5 && details.SalesTax == 4 && details.TotalCost == 72);
            }