Пример #1
0
        public void CalculateTotalTax_Import_Exempt()
        {
            List <Product> products = new List <Product>();
            ShoppingBag    cart     = new ShoppingBag();

            products.Add(new Product
            {
                ShoppingBagID = 1,
                ProductName   = "foodstuff",
                Quantity      = 1,
                Price         = 10.00M,
                IsImport      = true,
                IsExempt      = true
            });
            products.Add(new Product
            {
                ShoppingBagID = 1,
                ProductName   = "foodstuff",
                Quantity      = 1,
                Price         = 10.00M,
                IsImport      = true,
                IsExempt      = true
            });
            cart.Products = products;

            RecieptGenerator.Calculation tax = new RecieptGenerator.Calculation();
            var result = tax.CalculateTotalTax(cart);

            Assert.AreEqual(result, 1.00M);
        }
Пример #2
0
        private string GetRecieptTotalTaxes(ShoppingBag cart)
        {
            Calculation tax        = new Calculation();
            decimal     totalTax   = Utility.Truncate(tax.CalculateTotalTax(cart));
            decimal     totalSales = Utility.Truncate(tax.CalculateTotalSales(cart));

            return(string.Format("\tKingdom Taxes: {0}\n\tTotal: {1}\n", totalTax, totalSales));
        }