Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
		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();
			}
		}