public void Workflow_can_return_custom_decisions_during_failure() { var workflowDecision = new Mock <WorkflowDecision>(false, false); var workflow = new WorkflowToReturnCustomActionOnClosing(workflowDecision.Object); var decisions = new[] { new FailWorkflowDecision("reason", "detail") }; _workflowEvents.Setup(w => w.NewEvents()).Returns(Events(decisions)); var workflowDecisions = workflow.Decisions(_workflowEvents.Object); Assert.That(workflowDecisions, Is.EqualTo(new[] { workflowDecision.Object })); }
public void Workflow_can_return_custom_decisions_during_completion() { var workflowDecision = new Mock <WorkflowDecision>(false, false); var workflow = new WorkflowToReturnCustomActionOnClosing(workflowDecision.Object); var decisions = new WorkflowDecision[] { new CompleteWorkflowDecision("result2", true) }; _workflowEvents.Setup(w => w.NewEvents()).Returns(Events(decisions.ToArray())); var workflowDecisions = workflow.Decisions(_workflowEvents.Object); Assert.That(workflowDecisions, Is.EqualTo(new[] { workflowDecision.Object })); }
public void Workflow_can_return_custom_decisions_during_cancellation() { var workflowDecision = new Mock <WorkflowDecision>(false, false); var workflow = new WorkflowToReturnCustomActionOnClosing(workflowDecision.Object); _workflowEvents.Setup(w => w.InterpretNewEventsFor(workflow)).Returns(new WorkflowDecision[] { new CancelWorkflowDecision("detail"), }); var workflowDecisions = workflow.NewExecutionFor(_workflowEvents.Object).Execute(); Assert.That(workflowDecisions, Is.EqualTo(new[] { workflowDecision.Object })); }