コード例 #1
0
ファイル: Agenda_Specs.cs プロジェクト: daffers/Magnum
		public void Building_a_agenda_from_the_consequence_rocks()
		{
			var context = MockRepository.GenerateMock<RuleContext<Customer>>();
			context.Expect(x => x.EnqueueAgendaAction(0, null)).IgnoreArguments();

			Action<int> action = null;
			action = MockRepository.GenerateMock<Action<int>>();
			var actionNode = new ActionNode(() => action(27));

			actionNode.Activate(context);

			context.VerifyAllExpectations();
		}
コード例 #2
0
ファイル: Agenda_Specs.cs プロジェクト: waqashaneef/Magnum
        public void Building_a_agenda_from_the_consequence_rocks()
        {
            var context = MockRepository.GenerateMock <RuleContext <Customer> >();

            context.Expect(x => x.EnqueueAgendaAction(0, null)).IgnoreArguments();

            Action <int> action = null;

            action = MockRepository.GenerateMock <Action <int> >();
            var actionNode = new ActionNode(() => action(27));

            actionNode.Activate(context);

            context.VerifyAllExpectations();
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>true if there is at least one node to be activated else returns false</returns>
        public bool DoOneStep()
        {
            if (GetNumberOfActiveProcess() > 0)
            {
                if (State == SequenceState.Pause)
                {
                    if (m_LastExecution != null)
                    {
                        m_LastExecution.Slot.Node.IsProcessing = false;
                    }
                }

                ProcessingContext     context     = m_CallStacks[m_CurrentCallStackIndex];
                ProcessingContextStep contextStep = context.PopStep();

                if (contextStep == null)
                {
                    m_CallStacks.Remove(context);
                    context.SequenceBase.ResetNodes();
                }
                else
                {
                    ActionNode node = contextStep.Slot.Node as ActionNode;
                    m_LastExecution = contextStep;

                    ActionNode.ProcessingInfo info = node.Activate(context, contextStep.Slot);
                    node.ErrorMessage = info.ErrorMessage;

                    if (info.State == ActionNode.LogicState.Error)
                    {
                        context.IsOnError = true;
                    }

                    if (State == SequenceState.Pause)
                    {
                        m_LastExecution.Slot.Node.IsProcessing = true;
                    }
                }
            }

            return(SetNextProcess());
        }
コード例 #4
0
ファイル: Agenda_Specs.cs プロジェクト: daffers/Magnum
		public void Building_an_agenda_from_the_action_node_of_t()
		{
			var customer = new Customer();

			var wme = MockRepository.GenerateMock<SessionElement<Customer>>();
			wme.Stub(x => x.Object).Return(customer);

			var context = MockRepository.GenerateMock<RuleContext<Customer>>();
			context.Stub(x => x.Element).Return(wme);

			context.Expect(x => x.EnqueueAgendaAction(0, null)).IgnoreArguments();

			var action = MockRepository.GenerateMock<Action<RuleContext<Customer>>>();

			var node = new ActionNode<Customer>(x => action(x));

			node.Activate(context);


			context.VerifyAllExpectations();
		}
コード例 #5
0
ファイル: Agenda_Specs.cs プロジェクト: waqashaneef/Magnum
        public void Building_an_agenda_from_the_action_node_of_t()
        {
            var customer = new Customer();

            var wme = MockRepository.GenerateMock <SessionElement <Customer> >();

            wme.Stub(x => x.Object).Return(customer);

            var context = MockRepository.GenerateMock <RuleContext <Customer> >();

            context.Stub(x => x.Element).Return(wme);

            context.Expect(x => x.EnqueueAgendaAction(0, null)).IgnoreArguments();

            var action = MockRepository.GenerateMock <Action <RuleContext <Customer> > >();

            var node = new ActionNode <Customer>(x => action(x));

            node.Activate(context);


            context.VerifyAllExpectations();
        }