public void FirstTestName() { var engine = new MagnumRulesEngine(); RuleDeclaration rule = CreateOnlineOrderRule(); engine.Add(rule); rule = CreateCustomerExistsRule(); engine.Add(rule); rule = CreateActiveNotPreferredRule(); engine.Add(rule); rule = CreatePreferredRule(); engine.Add(rule); var visitor = new StringNodeVisitor(); engine.Visit(visitor); Trace.WriteLine(visitor.Result); using (StatefulSession session = engine.CreateSession()) { session.Assert(CurrentOrder); session.Run(); } }
private void AddOverLimitRule() { Expression <Func <OrderSubmitted, bool> > exp = o => o.Amount > 1000.00m; ConditionDeclaration condition = Declaration.Condition(exp); ConsequenceDeclaration <OrderSubmitted> consequence = Declaration.Consequence <OrderSubmitted>(o => _overLimit(o.Element.Object)); RuleDeclaration rule = Declaration.Rule(new[] { condition }, new[] { consequence }); _engine.Add(rule); }
public void Setup() { //TODO Dru needs to see this _engine = new MagnumRulesEngine(); _engine.Add(CreateOnlineOrderRule()); _engine.Add(CustomerIsSpecified()); _engine.Add(CreateActiveNotPreferredRule()); _engine.Add(CreatePreferredRule()); _engine.Add(CreateOnlinePreferredOrderRule()); }