Example #1
0
        public void should_throw_for_unrecognized_comparison_operators()
        {
            var ruleEngine = new RuleEngine();

            Assert.Throws<UnrecognizedComparisonOperatorException>(() =>
            {
                ruleEngine.CheckCondition("Age > 10 OR TotalProjects notexistsoperator 5", new Person
                {
                    Age = 5
                });
            });
        }
Example #2
0
        public void should_throw_for_unrecognized_params()
        {
            var ruleEngine = new RuleEngine();

            Assert.Throws<UnrecognizedParameterException>(() =>
            {
                var condition = "Age > 10 OR NotExistParam == 5";
                ruleEngine.CheckCondition(condition, new Person
                {
                    Age = 10
                });
            });
        }
Example #3
0
 private bool CheckCondition(string condition, object contextModel)
 {
     var ruleEngine = new RuleEngine();
     return ruleEngine.CheckCondition(condition, contextModel);
 }