public void Scenario1Test() { var book = new Product(bookCategory) { Description = "book", Price = 12.49f }; var musicCd = new Product(otherCategory) { Description = "music CD", Price = 14.99f }; var chocoletBar = new Product(foodCategory) { Description = "chocolate bar", Price = 0.85f }; var basket = new Basket(book, musicCd, chocoletBar); var receipt = target.ApplyTaxes(basket); Assert.AreEqual("Sale Taxes: £1.50", receipt.SaleTaxesDescription); Assert.AreEqual("Total: £29.83", receipt.TotalDescription); Assert.NotNull(receipt.ProductSummary); Assert.AreEqual(3, receipt.ProductSummary.Length); Assert.AreEqual("1 book: £12.49", receipt.ProductSummary[0]); Assert.AreEqual("1 music CD: £16.49", receipt.ProductSummary[1]); Assert.AreEqual("1 chocolate bar: £0.85", receipt.ProductSummary[2]); }
private static void Print(IBasket basket) { var receipt = taxApplier.ApplyTaxes(basket); receipt .ProductSummary .ToList() .ForEach(summary => Console.WriteLine(summary)); Console.WriteLine(receipt.SaleTaxesDescription); Console.WriteLine(receipt.TotalDescription); }