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)); }
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))); }
public void AddRule(Rule rule) { this.rules.Add(rule); if (this.notfired != null) this.nottested.Add(rule); }