public void RuleEngine_DiscountsBenefitCost() { //Arrange var benefitRule = new BenefitRule() { Amount = -10, AdjustmentType = Enums.AdjustmentType.Percentage, }; target.Start(testEmployee); target.SetRule(benefitRule); mStrategy.Setup(x => x.ApplyRule(It.IsAny <Employee>())) .Returns(1000); var expectedBenefitCost = 1900; //Act target.ApplyRule(); //Assert Assert.AreEqual(expectedBenefitCost, target.End()); }
public void SetRule(BenefitRule rule) { _rule = rule; _rule.Strategy = _ruleFactory.Create((RuleType)rule.BenefitRuleId); }