public void CanReadMethods() { var condition = new ExpressionCondition("Person.IsMinor", "is true"); var action = new AssignAction("Person.Salutation", "To the parents of"); var rule = CreateTestRule(condition, action); _ruleSet.AddRule(rule); var engine = WFRuleEngine.Compile(_ruleSet); var person = new TestPerson { BirthDate = DateTime.Today }; _workingMemory.Add("Person", person); engine.Invoke(_workingMemory); Assert.AreEqual("To the parents of", person.Salutation); }
public void CanReadAndWriteProperties() { var condition = new ExpressionCondition("Person.Sex", "is", "Male"); var action = new AssignAction("Person.Salutation", "Mr."); Rule rule = CreateTestRule(condition, action); _ruleSet.AddRule(rule); var person = new TestPerson { Sex = "Male" }; var engine = WFRuleEngine.Compile(_ruleSet); _workingMemory.Add("Person", person); engine.Invoke(_workingMemory); Assert.AreEqual("Mr.", person.Salutation); }