public void ShouldExecuteSingleStandAloneAbsolutePromotionOnShoppingCart() { Item b = new Item("B", 30.00); IPromotion twoBfor45 = new StandAloneAbsolutePromotion(b, 2, 45.00); ShoppingCart sc = new ShoppingCart(); sc.AddItem(b, 5); Dictionary <Item, int> cartDetails = sc.GetCartDetails(); List <IPromotion> promoList = new List <IPromotion>(); promoList.Add(twoBfor45); Assert.NotNull(cartDetails); Assert.Equal(120, sc.GetCartTotalWithPromotion(promoList)); }
private List <IPromotion> GetAvailablePromotions(Item a, Item b, Item c, Item d) { IPromotion threeAFor130 = new StandAloneAbsolutePromotion(a, 3, 130.00); IPromotion twoBFor45 = new StandAloneAbsolutePromotion(b, 2, 45.00); List <Item> itemList = new List <Item>(); itemList.Add(c); itemList.Add(d); IPromotion cAndDFor30 = new CumulativeAbsolutePromotion(itemList, 30.00); List <IPromotion> promoList = new List <IPromotion>(); promoList.Add(threeAFor130); promoList.Add(twoBFor45); promoList.Add(cAndDFor30); return(promoList); }