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)); }
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); }