public void TestBasketTotaling() { IBasket basket = new Basket(); IBasket basketWithBreadOffer = new BasketWithBreadOffer(basket); IBasket sut = new BasketWithMilkOffer(basketWithBreadOffer); var productFactory = new ProductFactory(); sut.AddProduct(productFactory.GetProduct("Butter")); sut.AddProduct(productFactory.GetProduct("Bread")); sut.AddProduct(productFactory.GetProduct("Milk")); Assert.AreEqual(2.95M, basket.Total); }
public void BasketWith4MilkTest() { var productFactory = new ProductFactory(); IBasket basket = new Basket(); IBasket basketWithBreadOffer = new BasketWithBreadOffer(basket); IBasket sut = new BasketWithMilkOffer(basketWithBreadOffer); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); Assert.AreEqual(3.45M, sut.Total); }
public void BasketWith8Milk2Butter1BreadTest() { var productFactory = new ProductFactory(); IBasket basket = new Basket(); IBasket basketWithBreadOffer = new BasketWithBreadOffer(basket); IBasket sut = new BasketWithMilkOffer(basketWithBreadOffer); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Milk")); sut.AddProduct(productFactory.GetProduct("Butter")); sut.AddProduct(productFactory.GetProduct("Bread")); sut.AddProduct(productFactory.GetProduct("Butter")); Assert.AreEqual(9.00M, sut.Total); }