public void ParseTestEmptyList() { float sum = 0; PromotionType2 promotionType2 = new PromotionType2(); var cost = promotionType2.Parse(new List <SKUItems>()); Assert.AreEqual(sum, cost); }
public void ParseTestListVar2() { float sum = 45; DummyCart dummyCart = new DummyCart(); var listItems = dummyCart.Generate0Promotion3(); PromotionType2 promotionType2 = new PromotionType2(); var cost = promotionType2.Parse(listItems); Assert.AreEqual(sum, cost); Assert.AreEqual(1, listItems.Count()); }
public float ParseCost(List <SKUItems> sKUItems) { float totalCost = 0; IPromotionLogic runningPromotion; runningPromotion = new PromotionType1(); totalCost += runningPromotion.Parse(sKUItems); runningPromotion = new PromotionType2(); totalCost += runningPromotion.Parse(sKUItems); runningPromotion = new PromotionType3(); totalCost += runningPromotion.Parse(sKUItems); foreach (var item in sKUItems) { totalCost += item.count * item.sKU.GetCost(); } return(totalCost); }