Esempio n. 1
0
        public void Throws_exception_when_two_signal_method_exists_for_same_signal_name_property()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_graphBuilder.WorkflowSignaledEvent("signal1", "input"));

            Assert.Throws <AmbiguousWorkflowMethodException>(() => workflowSignaledEvent.Interpret(new WorkflowWithTwoSignalMethodsForSameSignalName(expectedAction)));
        }
        public void Workflow_can_reply_to_signal_event()
        {
            var workflowSignaledEvent = new WorkflowSignaledEvent(_builder.WorkflowSignaledEvent("name", "input", "runid", "wid"));

            var decisions = workflowSignaledEvent.Interpret(new WorkflowToReplyToSignalEvent("newSignal", "newInput")).GetDecisions();

            Assert.That(decisions, Is.EqualTo(new [] { new SignalWorkflowDecision("newSignal", "newInput", workflowSignaledEvent.ExternalWorkflowId, workflowSignaledEvent.ExternalWorkflowRunid) }));
        }
        public void By_default_returns_workflow_ignore_action()
        {
            var workflowSignaledEvent = new WorkflowSignaledEvent(_builder.WorkflowSignaledEvent("name", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new EmptyWorkflow());

            Assert.That(workflowAction.GetDecisions(), Is.Empty);
        }
        public void Can_return_custom_workflow_action()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_builder.WorkflowSignaledEvent("name", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new WorkflowWithCustomActionOnSignal(expectedAction));

            Assert.That(workflowAction, Is.EqualTo(expectedAction));
        }
Esempio n. 5
0
        public void Signal_method_with_a_signal_name_takes_priority_over_matching_signal_method()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_graphBuilder.WorkflowSignaledEvent("signal1", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new WorkflowWithMatchingSignalMethodAndName(expectedAction));

            Assert.That(workflowAction, Is.EqualTo(expectedAction));
        }
Esempio n. 6
0
        public void Signal_can_be_handled_by_signal_method_by_giving_a_signal_name_property()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_graphBuilder.WorkflowSignaledEvent("signal1", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new WorkflowWithSignalName(expectedAction));

            Assert.That(workflowAction, Is.EqualTo(expectedAction));
        }
Esempio n. 7
0
        public void Signal_can_be_handled_using_matching_signal_method()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_graphBuilder.WorkflowSignaledEvent("signal1", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new WorkflowWithSignalAttribute(expectedAction));

            Assert.That(workflowAction, Is.EqualTo(expectedAction));
        }
Esempio n. 8
0
        public void Fall_back_to_generic_workflow_event_handler_when_signal_name_does_not_match()
        {
            var expectedAction        = new Mock <WorkflowAction>().Object;
            var workflowSignaledEvent = new WorkflowSignaledEvent(_graphBuilder.WorkflowSignaledEvent("signal1", "input"));

            var workflowAction = workflowSignaledEvent.Interpret(new WorkflowWithNotMatchingSignalMethod(expectedAction));

            Assert.That(workflowAction, Is.EqualTo(expectedAction));
        }
        public void Reply_to_signal_event_not_sent_by_a_workflow_generate_exception()
        {
            var workflowSignaledEvent = new WorkflowSignaledEvent(_builder.WorkflowSignaledEvent("name", "input"));

            Assert.Throws <SignalException>(() => workflowSignaledEvent.Interpret(new WorkflowToReplyToSignalEvent("newSignal", "newInput")));
        }