Beispiel #1
0
        public void BasicTaxOnCheckoutForLocalNonBasicTaxExemptArticles(int n)
        {
            var checkoutCountry = Country.Ita;
            var supplierCountry = checkoutCountry;
            var exemptCats      = new[] { Category.Books, Category.Food, Category.Medical };
            var categories      = Enum.GetValues(typeof(Category)).Cast <Category>().Except(exemptCats).ToList();
            var expectedTax     = new BasicTax();

            CheckReceiptTaxedPrice(n, categories, supplierCountry, checkoutCountry, expectedTax);
        }
Beispiel #2
0
        public void BasicTaxIsRoundedUpToFiveCents()
        {
            var basicTax = new BasicTax();

            Assert.Equal(1.91M + 0.20M, basicTax.ApplyTo(1.91M));
            Assert.Equal(1.51M + 0.20M, basicTax.ApplyTo(1.51M));
            Assert.Equal(1.50M + 0.15M, basicTax.ApplyTo(1.50M));
            Assert.Equal(1.42M + 0.15M, basicTax.ApplyTo(1.42M));
            Assert.Equal(1.09M + 0.15M, basicTax.ApplyTo(1.09M));
            Assert.Equal(1.00M + 0.10M, basicTax.ApplyTo(1.00M));
        }
Beispiel #3
0
        public void PurchaseAppliesTax()
        {
            var article  = new Article(1, Country.Ita, Category.ArtsAndCrafts, Guid.NewGuid().ToString(), 100);
            var tax      = new BasicTax();
            var purchase = new Purchase(article.SupplierCountry);

            purchase.Add(article, 1, tax);
            var receipt = purchase.BuildReceipt();

            Assert.NotEqual(article.Price, receipt.Total);
        }
Beispiel #4
0
        public void ReceiptForOneArticleMatchesItsData()
        {
            var articleName = Guid.NewGuid().ToString();
            var article     = new Article(1, Country.Ita, Category.ArtsAndCrafts, articleName, 100);
            var purchase    = new Purchase(article.SupplierCountry);
            var tax         = new BasicTax();

            purchase.Add(article, 1, tax);
            var receipt = purchase.BuildReceipt();
            var entry   = receipt.Entries.Single();

            const int quantity       = 1;
            var       priceWithTaxes = tax.ApplyTo(article.Price);

            Assert.Equal(articleName, entry.Description);
            Assert.Equal(quantity, entry.Quantity);
            Assert.Equal(priceWithTaxes, entry.TotalPriceWithTaxes);
            Assert.Equal(priceWithTaxes - article.Price, receipt.Taxes);
            Assert.Equal(priceWithTaxes, receipt.Total);
        }