public void OneTypeSkuFlatPricePromotionTest() { var cart = new PR.Cart(); var product = new PR.Product(PR.SKUType.A, 50); cart.AddItem(product); var flatPriceRule = new PR.ProductPromoter(product.SkuType, product.Price, 3, 130, 1); var promoRuleList = new List <PR.ProductPromoter>(); promoRuleList.Add(flatPriceRule); //PR.IPromotion promotion = new PR.FlatPricePromotion(promoRuleList); PR.ProductPromotionStrategy promotion = new PR.FlatPricePromotion(promoRuleList); Assert.Equal(" 3 A(s) @ 130$", promotion.ToString()); }
public void Promotion_AddMultipleSkuTest() { var cart = new PR.Cart(); var productA = new PR.Product(PR.SKUType.A, 50); var productB = new PR.Product(PR.SKUType.B, 30); cart.AddItem(productA); for (int i = 0; i < 2; i++) { cart.AddItem(productB); } var flatPriceRule1 = new PR.ProductPromoter(productA.SkuType, productA.Price, 1, 50, 1); var flatPriceRule2 = new PR.ProductPromoter(productB.SkuType, productB.Price, 2, 30, 1); var promoRuleList = new List <PR.ProductPromoter>(); promoRuleList.Add(flatPriceRule1); promoRuleList.Add(flatPriceRule2); PR.ProductPromotionStrategy promotion = new PR.FlatPricePromotion(promoRuleList); Assert.Equal(" 1 A @ 50$ 2 B(s) @ 30$", promotion.ToString()); }