public void Promotion_3A_Returns_Total() { calculationReceiver = new PromotionA(); var items = ShoppingCartOM.GetPromotion3AItems(); var total = calculationReceiver.Process(items, 0); Assert.Equal(130, total.Item2); Assert.Equal(2, items.FirstOrDefault(item => item.SKU == Domain.SKUEnum.A).Quantity); }
public void Promotion_2B_Returns_Total() { calculationReceiver = new PromotionB(); var items = ShoppingCartOM.GetPromotion2BItems(); var total = calculationReceiver.Process(items, 0); Assert.Equal(45, total.Item2); Assert.Null(items.FirstOrDefault(item => item.SKU == Domain.SKUEnum.B)); }
public void Promotion_ALL1_Returns_Total() { calculationHandler = new CalculationHandler(); calculationReceivers = new List <ICalculationReceiver> { new PromotionA(), new PromotionB(), new PromotionCD(), new CalculateTotal() }; var items = ShoppingCartOM.GetPromotionAll1Items(); var total = calculationHandler.Handle(items, calculationReceivers.ToList()); Assert.Equal(100, total); }
public void GetItemsTest() { var cart = ShoppingCartOM.GetItems(); Assert.NotNull(cart.Items); }