Пример #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
        public void CalculateTotal_HasTaxCost()
        {
            decimal price   = 10.00M;
            decimal taxCost = 0.50M;

            RecieptGenerator.Calculation tax = new RecieptGenerator.Calculation();
            var result = tax.CalculateTotal(price, taxCost);

            Assert.AreEqual(result, 10.50M);
        }
Пример #3
0
        public void GetTaxCost_IsImported_NonExempt()
        {
            decimal price    = 47.50M;
            bool    isImport = true;
            bool    isExempt = false;

            RecieptGenerator.Calculation tax = new RecieptGenerator.Calculation();
            var result = tax.GetTaxCost(price, isImport, isExempt);

            Assert.AreEqual(result, 7.15M);
        }
Пример #4
0
        public void GetTaxCost_NotImported_Exempt()
        {
            decimal price    = 10.00M;
            bool    isImport = true;
            bool    isExempt = true;

            RecieptGenerator.Calculation tax = new RecieptGenerator.Calculation();
            var result = tax.GetTaxCost(price, isImport, isExempt);

            Assert.AreEqual(result, 0.50M);
        }
Пример #5
0
        public void CalculateTotalSales_NotImported_HasExempt()
        {
            List <Product> products = new List <Product>();
            ShoppingBag    cart     = new ShoppingBag();

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

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

            Assert.AreEqual(result, 10.00M);
        }