public PromotionRuleEngineTests() { _mockProductDataAccessService = new Mock <IProductDataAccessService>(); _mockPromotionRuleDataAccessService = new Mock <IPromotionRuleDataAccessService>(); _promotionRuleEngine = new PromotionRuleEngine(_mockProductDataAccessService.Object , _mockPromotionRuleDataAccessService.Object); _cart = null; }
public void Promotion_WhenNoProducts_PriceIsZero() { var promotionEngine = new PromotionRuleEngine(GetPromotionPricingRules()); var products = new List <string>(); var totalAmount = promotionEngine.GetTotalAmount(products); Assert.AreEqual(0, totalAmount); }
public void Promotion_OneA_OneB_OneC_OneD_Is280() { var promotionEngine = new PromotionRuleEngine(GetPromotionPricingRules()); var products = new List <string> { "A", "B", "C", "D" }; var totalAmount = promotionEngine.GetTotalAmount(products); Assert.AreEqual(115, totalAmount); }
public void Promotion_FiveA_FiveB_OneC_Is370() { var promotionEngine = new PromotionRuleEngine(GetPromotionPricingRules()); var products = new List <string> { "A", "B", "C", "A", "B", "A", "B", "A", "B", "A", "B" }; var totalAmount = promotionEngine.GetTotalAmount(products); Assert.AreEqual(370, totalAmount); }
public void Promotion_ThreeA_ThreeB_Is205() { var promotionEngine = new PromotionRuleEngine(GetPromotionPricingRules()); var products = new List <string> { "A", "A", "A", "B", "B", "B" }; var totalAmount = promotionEngine.GetTotalAmount(products); Assert.AreEqual(205, totalAmount); }