public void A_rule_with_a_named_match() { string text = @" rule YourRule when $name : MyClass(Name == 'Mary', City == 'Tulsa') then end"; Console.WriteLine(text); var parser = new StringRuleParser(); Result <string, RuleDefinition> result = parser.Rule(text); Assert.IsNotNull(result); Assert.IsNotNull(result.Value); RuleDefinition rule = result.Value; Assert.AreEqual("YourRule", rule.Name); Assert.AreEqual(1, rule.Conditions.Length); RuleConditionImpl condition = rule.Conditions[0]; Assert.IsNotNull(condition); var namedCondition = condition as AssignedRuleCondition; Assert.IsNotNull(namedCondition); Assert.AreEqual("name", namedCondition.Variable.Name); }
public ClassRuleCondition(string className, RuleConditionImpl[] conditions) { _className = className; _conditions = conditions; }