Example #1
0
        public void Reschedule_timer_when_total_number_of_scheduling_is_less_than_allowed_limit()
        {
            var workflow   = new WorkflowToRescheduleActivityWithTimerUpToLimit(2);
            var completed1 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);
            var completed2 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);

            var historyEvents = new WorkflowHistoryEvents(completed2.Concat(completed1), completed2.Last().EventId, completed2.First().EventId);

            var decisions = workflow.NewExecutionFor(historyEvents).Execute();

            Assert.That(decisions, Is.EqualTo(new[] { new ScheduleTimerDecision(Identity.New(_activityName, _activityVersion, _positionalName), TimeSpan.FromSeconds(2), true) }));
        }
Example #2
0
        public void Schedule_next_item_when_total_number_of_scheduling_events_exceeds_configured_limit()
        {
            var workflow   = new WorkflowToRescheduleActivityWithTimerUpToLimit(2);
            var completed1 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);
            var completed2 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);
            var completed3 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName);

            var historyEvents = new WorkflowHistoryEvents(completed3.Concat(completed2.Concat(completed1)), completed3.Last().EventId, completed3.First().EventId);

            var decisions = workflow.NewExecutionFor(historyEvents).Execute();

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