Beispiel #1
0
        public void CreateRuleSetWithNullNameFails()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "";

            Assert.Throws <ArgumentException>(() => rmsx.CreateRuleSet(newRuleSetName));
        }
Beispiel #2
0
        public void CreateRuleSetReturnsNewRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            RuleSet ruleSet        = rmsx.CreateRuleSet(newRuleSetName);

            Assert.That(ruleSet.GetName(), Is.EqualTo(newRuleSetName));
        }
Beispiel #3
0
        public void RuleSetGetNameShouldReturnName()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            RuleSet rs             = rmsx.CreateRuleSet(newRuleSetName);

            Assert.That(rs.GetName(), Is.EqualTo(newRuleSetName));
        }
Beispiel #4
0
        public void GetRuleSetWithIncorrectNameReturnsNull()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";

            rmsx.CreateRuleSet(newRuleSetName);
            RuleSet rs = rmsx.GetRuleSet("SomeOtherName");

            Assert.IsNull(rs);
        }
Beispiel #5
0
        public void GetRuleSetByNameReturnsCorrectRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";

            rmsx.CreateRuleSet(newRuleSetName);
            RuleSet rs = rmsx.GetRuleSet(newRuleSetName);

            Assert.That(rs.GetName(), Is.EqualTo(newRuleSetName));
        }
Beispiel #6
0
        public void GetRuleSetsReturnsRuleSetCollection()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";

            rmsx.CreateRuleSet(newRuleSetName);
            List <RuleSet> rsl = rmsx.GetRuleSets();
            RuleSet        rs  = rsl[0];

            Assert.That(rs.GetName(), Is.EqualTo(newRuleSetName));
        }
Beispiel #7
0
        public void GetRulesReturnsCorrectListOfRules()
        {
            RuleMSX     rmsx           = new RuleMSX();
            string      newRuleSetName = "NewRuleSet";
            string      newRuleName    = "NewRuleName";
            RuleSet     rs             = rmsx.CreateRuleSet(newRuleSetName);
            Rule        ri             = rs.AddRule(newRuleName);
            List <Rule> rl             = rs.GetRules();
            Rule        ro             = rl[0];

            Assert.That(ro.GetName(), Is.EqualTo(newRuleName));
        }
Beispiel #8
0
        public void RuleMSXStopShouldReturnTrueWithActiveRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            string  newDataSetName = "NewDataSet";
            string  newRuleName    = "Rule1";
            RuleSet rs             = rmsx.CreateRuleSet(newRuleSetName);

            rs.AddRule(newRuleName);
            DataSet ds = rmsx.CreateDataSet(newDataSetName);

            rs.Execute(ds);
            Assert.That(rmsx.Stop(), Is.EqualTo(true));
        }
Beispiel #9
0
        public void RuleMSXStopShouldReturnTrueWithUnexecutedRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            string  newDataSetName = "NewDataSet";
            string  newRuleName    = "Rule1";
            RuleSet rs             = rmsx.CreateRuleSet(newRuleSetName);

            rs.AddRule(newRuleName);
            DataSet ds = rmsx.CreateDataSet(newDataSetName);

            // We are deliberately not executing the ruleset...
            //rs.Execute(ds);
            Assert.That(rmsx.Stop(), Is.EqualTo(true));
        }