Esempio n. 1
0
        public void RuleNotFireInEmptyWorld()
        {
            Rule rule = new Rule(new Fact[] {
                new IsFact("Temperature", 40),
                new IsFact("Age", 50)
            }, null);

            World world = new World();

            Assert.IsFalse(rule.FireIfReady(world));
        }
Esempio n. 2
0
        public void RuleFire()
        {
            Rule rule = new Rule(new Fact[] {
                new IsFact("Temperature", 40),
                new IsFact("Age", 50)
            }, new Fact[] {
                new IsFact("HasFever", true)
            });

            World world = new World();
            world.AssertFact(new IsFact("Age", 50));
            world.AssertFact(new IsFact("Temperature", 40));

            Assert.IsTrue(rule.FireIfReady(world));
            Assert.IsTrue(world.IsAFact(new IsFact("HasFever", true)));
        }
Esempio n. 3
0
 public void AddRule(Rule rule)
 {
     this.rules.Add(rule);
     if (this.notfired != null)
         this.nottested.Add(rule);
 }