Example #1
0
    testBusinessRuleEvaluatorCannotAddRuleWhenItsNotARule: function (test) {
        var re = new BusinessRuleEvaluator();
        var r = {};
        re.addRule(r).then(function (result) {

        }).fail(function (result) {
                test.equal(result, 'The rule to evaluate is not a rule object.');
                test.done();
            });
    },
Example #2
0
    testBusinessRuleEvaluatorCannotAddUndefinedRule: function (test) {
        var re = new BusinessRuleEvaluator();

        re.addRule().then(function (result) {

        }).fail(function (result) {
                test.equal(result, 'The rule should be specified for evaluation.');
                test.done();
            });
    },
Example #3
0
 testBusinessRuleEvaluatorCanAddBusinessRule: function (test) {
     var re = new BusinessRuleEvaluator();
     var r = new BusinessRule({ruleName: 'HasAName', condition: new RuleCondition(function (item) {
         return item.value;
     })});
     re.addRule(r).then(function (result) {
         test.equal(result, r);
         test.done();
     });
 },
Example #4
0
    testBusinessRuleEvaluatorCanNotAddRule: function (test) {
        var re = new BusinessRuleEvaluator();
        var r = new Rule({ruleName: 'HasAName', condition: new RuleCondition(function (item) {
            return item.value;
        })});
        re.addRule(r).then(function (result) {

        }).fail(function (result) {
                test.equal(result, 'The rule to evaluate is not a rule object.');
                test.done();
            });
    },