public static void A_Item_Discount_Processor_Applies_Discount_Of_20_To_5_A_Items() { var discountProcessor = new AItemDiscountProcessor(); var aItem1 = new Item { Name = "A", Price = 50 }; var aItem2 = new Item { Name = "A", Price = 50 }; var aItem3 = new Item { Name = "A", Price = 50 }; var aItem4 = new Item { Name = "A", Price = 50 }; var aItem5 = new Item { Name = "A", Price = 50 }; var items = new List<Item> { aItem1, aItem2, aItem3, aItem4, aItem5 }; var discountResult = discountProcessor.CalculateDiscountForItems(items); var discount = discountResult.DiscountAwarded; Assert.AreEqual(discount, 20); }
public static void Three_A_Items_Applies_Discount_Costing_130() { var aItemDiscountProcessor = new AItemDiscountProcessor(); var cart = new ShoppingCart(new List<IDiscountProcessor> {aItemDiscountProcessor}); var aItem1 = new Item {Name = "A", Price = 50}; var aItem2 = new Item {Name = "A", Price = 50}; var aItem3 = new Item {Name = "A", Price = 50}; cart.AddItem(aItem1); cart.AddItem(aItem2); cart.AddItem(aItem3); Assert.AreEqual(cart.Total, 130); }