Example #1
0
        public void DoNotRunIfHasRuleViolation_ShouldRunClauseAdded()
        {
            var rule = new Rule ( "Rule1" );
            var ruleBuilder = new RuleBuilder<RuleEngineContext<Customer>, Customer> ( rule );
            ruleBuilder.DoNotRunIfHasRuleViolation ();

            var ruleEngineContext = new RuleEngineContext ( new Customer () );
            ruleEngineContext.RuleViolationReporter.Report ( new RuleViolation ( rule, null, null ) );

            var shouldRunResult = rule.ShouldRunRule ( ruleEngineContext );

            Assert.IsFalse ( shouldRunResult );
        }