Example #1
0
        public void Returns_complete_workflow_decision_when_only_propose_to_complete_workflow_decision_is_generated()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new[] { new CompleteWorkflowDecision("complete", true) });

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("complete") }));
        }
Example #2
0
        public void Filters_out_activity_scheduling_decisions_when_generated_along_with_cancel_workflow_decision()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(AllNonCompletingDecisions().Concat(new[] { new CancelWorkflowDecision("detail") }));

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new CancelWorkflowDecision("detail") }));
        }
Example #3
0
        public void Filters_out_propose_to_complete_workflow_decision_and_any_scheduling_decision_when_it_is_generated_along_with_complete_workflow_decision()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(AllNonCompletingDecisions().Concat(new[] { new CompleteWorkflowDecision("complete", true),
                                                                                                                             new CompleteWorkflowDecision("complete3") }));

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("complete3") }));
        }
Example #4
0
        public void Filters_out_propose_to_complete_workflow_decision_when_it_is_generated_along_with_other_decisions()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new WorkflowDecision[] { new CompleteWorkflowDecision("complete", true),
                                                                                                           new ScheduleActivityDecision(Identity.New("something", "1.0")) });

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new ScheduleActivityDecision(Identity.New("something", "1.0")) }));
        }
Example #5
0
        public void Filters_out_empty_workflow_decisions()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new[] { new CompleteWorkflowDecision("complete"), WorkflowDecision.Empty });
            _workflowEvents.Setup(h => h.HasActiveEvent()).Returns(true);

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("complete") }));
        }
Example #6
0
        public void Returns_empty_decisions_when_only_propose_to_complete_workflow_decision_is_generated_and_workflow_is_active()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new[] { new CompleteWorkflowDecision("complete", true) });
            _workflowEvents.Setup(h => h.HasActiveEvent()).Returns(true);

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.Empty);
        }
Example #7
0
        public void Return_complete_workflow_decision_when_it_generated_along_with_a_proposed_complete_workflow_decision()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new WorkflowDecision[]
            {
                new CompleteWorkflowDecision("result", false),
                new CompleteWorkflowDecision("result2", true),
            });

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("result") }));
        }
Example #8
0
        public void Returns_fail_workflow_decision_when_multiple_close_workflow_decisions_are_generated()
        {
            var workflow = new StubWorkflow();

            _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new WorkflowDecision[]
            {
                new CompleteWorkflowDecision("result", false),
                new CancelWorkflowDecision("detail"),
                new CompleteWorkflowDecision("result2", true),
                new FailWorkflowDecision("reason", "detail"),
            });

            var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute();

            Assert.That(workflowDecisions, Is.EqualTo(new[] { new FailWorkflowDecision("reason", "detail") }));
        }