Ejemplo 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();
            }
        }
Ejemplo n.º 2
0
        public void FirstTestName()
        {
            _order.Amount = 10000.00m;

            using (var session = _engine.CreateSession())
            {
                session.Assert(_order);
                session.Run();
            }

            _overLimit.VerifyAllExpectations();
            _underLimit.VerifyAllExpectations();
        }
Ejemplo n.º 3
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();
			}
		}