Example #1
0
        public void Can_return_custom_action()
        {
            var customAction   = WorkflowAction.CompleteWorkflow("result");
            var workflowAction = _event.Interpret(new WorkflowWithCustomAction(customAction));

            Assert.That(workflowAction, Is.EqualTo(customAction));
        }
Example #2
0
        public void Can_combine_two_workflow_actions_using_and_function()
        {
            var workflowAction = WorkflowAction.FailWorkflow("reason", "detail").And(WorkflowAction.CompleteWorkflow("result"));

            var workflowDecisions = workflowAction.GetDecisions();

            Assert.That(workflowDecisions, Is.EquivalentTo(new WorkflowDecision[] { new FailWorkflowDecision("reason", "detail"), new CompleteWorkflowDecision("result") }));
        }
Example #3
0
        public void Can_combine_two_workflow_actions_using_plus_operator()
        {
            var workflowAction = WorkflowAction.FailWorkflow("reason", "detail") + WorkflowAction.CompleteWorkflow("result");

            var workflowDecisions = workflowAction.Decisions(Mock.Of <IWorkflow>());

            Assert.That(workflowDecisions, Is.EquivalentTo(new WorkflowDecision [] { new FailWorkflowDecision("reason", "detail"), new CompleteWorkflowDecision("result") }));
        }
Example #4
0
        public void Serialize_complex_result_to_json()
        {
            var workflowAction = WorkflowAction.CompleteWorkflow(new { Id = 10, Name = "hello" });

            var decision = workflowAction.GetDecisions();

            Assert.That(decision, Is.EquivalentTo(new[] { new CompleteWorkflowDecision(@"{""Id"":10,""Name"":""hello""}") }));
        }
Example #5
0
        public void Should_return_complete_workflow_decision()
        {
            var workflowAction = WorkflowAction.CompleteWorkflow("result");

            var decision = workflowAction.GetDecisions();

            Assert.That(decision, Is.EquivalentTo(new [] { new CompleteWorkflowDecision("result") }));
        }
Example #6
0
        public void Can_schedule_custom_action()
        {
            var decisions = _event.Interpret(new WorkflowWithCustomAction(WorkflowAction.CompleteWorkflow("result"))).Decisions(Mock.Of <IWorkflow>());

            Assert.That(decisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("result") }));
        }