public void Add_Physical_Product_Rule() { Payment payment = new Payment { PaymentType = PaymentType.PhysicalProduct, ProductName = "Computer" }; IRule rule = new Rule_PhysicalProduct(); ruleManager.AddRule(rule); var ruleResult = ruleManager.ExecuteRules(payment); bool isPhysicalRuleApplied = ruleResult.Contains("Generate Packing Slip"); Assert.IsTrue(isPhysicalRuleApplied); }
public void Add_Book_And_Physical_Rule() { Payment payment = new Payment { PaymentType = PaymentType.PhysicalProduct, ProductName = "Harry Potter Book", IsBook = true }; IRule rule = new Rule_Book(); ruleManager.AddRule(rule); // Both rule so that both rules will be added to rule result; rule = new Rule_PhysicalProduct(); ruleManager.AddRule(rule); var ruleResult = ruleManager.ExecuteRules(payment); bool isBookRuleApplied = ruleResult.Contains("Packing Slip for Royalty Department"); Assert.IsTrue(isBookRuleApplied); bool isPhysicalRuleApplied = ruleResult.Contains("Generate Packing Slip"); Assert.IsTrue(isPhysicalRuleApplied); }