Exemple #1
0
        public void SalesTax()
        {
            //Arrange
            var data                = "1 Bottle of perfume at 18.99";
            var itemData            = new Parser(data);
            var importTaxCalculator = new SalesTax.Items.ImportTax(".05");
            var salesTaxCalculator  = new  SalesTax.Items.SalesTax(".10");

            var item = new SalesTax.Items.Item(itemData.Description, itemData.Price, itemData.Qty, itemData.Category, itemData.IsTaxExempt, itemData.IsImport, salesTaxCalculator, importTaxCalculator);

            //Act
            var salesTax = item.CalculateSalesTax();

            //Assert
            Assert.IsTrue(salesTax == 1.90m);
        }
Exemple #2
0
        public void ItemTotalCost()
        {
            //Arrange
            var data                = "1 Imported Bottle of perfume at 27.99";
            var itemData            = new Parser(data);
            var importTaxCalculator = new SalesTax.Items.ImportTax(".05");
            var salesTaxCalculator  = new  SalesTax.Items.SalesTax(".10");

            var item = new SalesTax.Items.Item(itemData.Description, itemData.Price, itemData.Qty, itemData.Category, itemData.IsTaxExempt, itemData.IsImport, salesTaxCalculator, importTaxCalculator);

            //Act
            var totalCost = item.TotalCost();

            //Assert
            Assert.IsTrue(totalCost == 32.19m);
        }
Exemple #3
0
        public void ImportTax()
        {
            //Arrange
            var data                = "1 Imported box of chocolates at 11.25";
            var itemData            = new Parser(data);
            var importTaxCalculator = new SalesTax.Items.ImportTax(".05");
            var salesTaxCalculator  = new  SalesTax.Items.SalesTax(".10");

            var item = new SalesTax.Items.Item(itemData.Description, itemData.Price, itemData.Qty, itemData.Category, itemData.IsTaxExempt, itemData.IsImport, salesTaxCalculator, importTaxCalculator);



            //Act
            var importTax = item.CalculateImportTax();

            //Assert
            Assert.IsTrue(importTax == .60m);
        }