示例#1
0
        public void Throws_exception_when_rescheduled_timer_is_not_found()
        {
            var workflow            = new SingleActivityWorkflow();
            var timerCancelledEvent = CreateRescheduledTimerCancelledEvent(Identity.New("DifferntName", SingleActivityWorkflow.ActivityVersion), _fireAfter);

            Assert.Throws <IncompatibleWorkflowException>(() => timerCancelledEvent.Interpret(workflow));
        }
示例#2
0
        public void Throws_exception_when_rescheduled_item_is_not_found_in_workflow()
        {
            var workflow        = new SingleActivityWorkflow();
            var rescheduleTimer = CreateRescheduleTimerFiredEvent(Identity.New("NotIntWorkflow", string.Empty, string.Empty), _fireAfter);

            Assert.Throws <IncompatibleWorkflowException>(() => rescheduleTimer.Interpret(workflow));
        }
示例#3
0
        public void By_default_return_cancel_workflow_decision()
        {
            var workflow = new SingleActivityWorkflow();

            var decisions = _activityCancelledEvent.Interpret(workflow).Decisions(Mock.Of <IWorkflow>());

            Assert.That(decisions, Is.EqualTo(new [] { new CancelWorkflowDecision(Detail) }));
        }
        public void By_default_return_continue_workflow_action()
        {
            var workflow = new SingleActivityWorkflow();

            var workflowAction = _activityCompletedEvent.Interpret(workflow);

            Assert.That(workflowAction, Is.EqualTo(WorkflowAction.ContinueWorkflow(new ActivityItem(Identity.New(_activityName, _activityVersion, _positionalName), null))));
        }
        public void By_default_should_fail_workflow()
        {
            var workflow = new SingleActivityWorkflow();

            var decisions = workflow.Decisions(_builder.Result());

            Assert.That(decisions, Is.EqualTo(new[] { new FailWorkflowDecision("ACTIVITY_SCHEDULING_FAILED", _cause) }));
        }
示例#6
0
        public void By_default_should_fail_workflow()
        {
            var workflow = new SingleActivityWorkflow();

            var decisions = _activitySchedulingFailedEvent.Interpret(workflow).GetDecisions();

            Assert.That(decisions, Is.EqualTo(new[] { new FailWorkflowDecision("ACTIVITY_SCHEDULING_FAILED", _cause) }));
        }
        public void Populate_workflow_details_with_activity_timedout_when_details_is_empty()
        {
            var workflow = new SingleActivityWorkflow();
            var activityTimedoutEvent = CreateActivityTimedoutEvent(_timeoutType, "");
            var decisions             = activityTimedoutEvent.Interpret(workflow).Decisions(Mock.Of <IWorkflow>());

            Assert.That(decisions, Is.EqualTo(new [] { new FailWorkflowDecision(_timeoutType, "ActivityTimedout") }));
        }
        public void By_default_return_fail_workflow_decision()
        {
            var workflow = new SingleActivityWorkflow();

            var decisions = _activityTimedoutEvent.Interpret(workflow).Decisions(Mock.Of <IWorkflow>());

            Assert.That(decisions, Is.EqualTo(new [] { new FailWorkflowDecision(_timeoutType, _detail) }));
        }
        public void Returns_complete_workflow_decision_when_no_schedulable_child_item_found()
        {
            _eventsBuilder.AddNewEvents(CompletedActivityEventGraph(_activityName, _activityVersion, _positionalName));

            var decisions = new SingleActivityWorkflow().Decisions(_eventsBuilder.Result());

            Assert.That(decisions, Is.EqualTo(new [] { new CompleteWorkflowDecision("Workflow is completed.") }));
        }
        public void By_default_return_fail_workflow_decision()
        {
            var workflow = new SingleActivityWorkflow();

            var decisions = _activityFailedEvent.Interpret(workflow).GetDecisions();

            Assert.That(decisions, Is.EqualTo(new [] { new FailWorkflowDecision(_reason, _detail) }));
        }
示例#11
0
        public void By_default_return_cancel_workflow_decision_for_rescheduled_timer()
        {
            var workflow            = new SingleActivityWorkflow();
            var timerCancelledEvent = CreateRescheduledTimerCancelledEvent(Identity.New(SingleActivityWorkflow.ActivityName, SingleActivityWorkflow.ActivityVersion), _fireAfter);

            var decisions = timerCancelledEvent.Interpret(workflow).GetDecisions();

            Assert.That(decisions, Is.EqualTo(new [] { new CancelWorkflowDecision("RESCHEDULE_TIMER_CANCELLED") }));
        }
        public void Returns_propose_to_complete_complete_decision_when_no_schedulable_child_item_found()
        {
            var workflow = new SingleActivityWorkflow();
            var workflowHistoryEvents = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);

            var decisions = workflowHistoryEvents.InterpretNewEventsFor(workflow);

            Assert.That(decisions, Is.EqualTo(new [] { new CompleteWorkflowDecision("Workflow is completed.", true) }));
        }
示例#13
0
        public void Should_return_schedule_workflow_action_if_timer_is_fired_to_reschedule_a_activity_item()
        {
            var workflow        = new SingleActivityWorkflow();
            var rescheduleTimer = CreateRescheduleTimerFiredEvent(Identity.New(_activityName, _activityVersion, _positionalName), _fireAfter);

            var workflowAction = rescheduleTimer.Interpret(workflow);

            Assert.That(workflowAction, Is.EqualTo(WorkflowAction.Schedule(new ActivityItem(Identity.New(_activityName, _activityVersion, _positionalName), null))));
        }
        public void Can_be_returned_as_custom_action_in_workflow()
        {
            var workflow = new SingleActivityWorkflow("reason", "detail");
            var completedActivityEventGraph = _builder.ActivityCompletedGraph(Identity.New(SingleActivityWorkflow.ActivityName, SingleActivityWorkflow.ActivityVersion, SingleActivityWorkflow.PositionalName), "id", "res");
            var completedActivityEvent      = new ActivityCompletedEvent(completedActivityEventGraph.First(), completedActivityEventGraph);

            var decisions = completedActivityEvent.Interpret(workflow).GetDecisions();

            Assert.That(decisions, Is.EqualTo(new [] { new FailWorkflowDecision("reason", "detail") }));
        }
        public void Can_be_returned_as_custom_action_in_workflow()
        {
            var workflow                    = new SingleActivityWorkflow("detail");
            var activityIdentity            = Identity.New(ActivityName, ActivityVersion, PositionalName).ScheduleId();
            var completedActivityEventGraph = _builder.ActivityCompletedGraph(activityIdentity, "id", "res");
            var completedActivityEvent      = new ActivityCompletedEvent(completedActivityEventGraph.First(), completedActivityEventGraph);

            var decisions = completedActivityEvent.Interpret(workflow).Decisions(Mock.Of <IWorkflow>());

            Assert.That(decisions, Is.EqualTo(new[] { new CancelWorkflowDecision("detail") }));
        }
示例#16
0
        public void Returns_schedule_activity_decision_if_timer_is_fired_to_reschedule_an_activity_item_using_old_data_object()
        {
            var workflow = new SingleActivityWorkflow();

            _builder.AddProcessedEvents(_graphBuilder.WorkflowStartedEvent());
            _builder.AddNewEvents(_graphBuilder.TimerFiredGraph(Identity.New(ActivityName, ActivityVersion, PositionalName).ScheduleId(), _fireAfter, true).ToArray());

            var workflowAction = workflow.Decisions(_builder.Result());

            Assert.That(workflowAction, Is.EqualTo(new[] { new ScheduleActivityDecision(Identity.New(ActivityName, ActivityVersion, PositionalName).ScheduleId()) }));
        }