Ejemplo n.º 1
0
        public void should_throw_for_unrecognized_params()
        {
            var ruleEngine = new ConditionEvaluator();

            Assert.Throws<UnrecognizedParameterException>(() =>
            {
                var condition = "Age > 10 OR NotExistParam == 5";
                ruleEngine.Evaluate(condition, new Person
                {
                    Age = 10
                });
            });
        }
Ejemplo n.º 2
0
        public PromotionModule(
            PromotionService promotionService,
            IPromotionPolicyProvider policyFactory,
            ConditionEvaluator ruleEngine)
        {
            Require.NotNull(promotionService, "promotionService");
            Require.NotNull(policyFactory, "policyFactory");
            Require.NotNull(ruleEngine, "ruleEngine");

            _promotionService = promotionService;
            _policyFactory = policyFactory;
            _ruleEngine = ruleEngine;
        }
Ejemplo n.º 3
0
        public override IEnumerable<ConfiguredActivity> Execute(object dataContext)
        {
            var evaluator = new ConditionEvaluator();
            var success = evaluator.Evaluate(Conditions, dataContext);

            if (success)
            {
                return Further(Then, dataContext);
            }
            else
            {
                return Further(Else, dataContext);
            }
        }
Ejemplo n.º 4
0
 public PromotionMatcher(ConditionEvaluator ruleEngine)
 {
     _ruleEngine = ruleEngine;
 }
Ejemplo n.º 5
0
 private bool CheckCondition(string condition, object contextModel)
 {
     var ruleEngine = new ConditionEvaluator();
     return ruleEngine.Evaluate(condition, contextModel);
 }
Ejemplo n.º 6
0
 public PromotionConditionChecker(ConditionEvaluator ruleEngine)
 {
     _ruleEngine = ruleEngine;
 }