public void Reschedule_activity_when_total_number_of_scheduling_is_less_than_allowed_limit() { var workflow = new WorkflowToScheduleActivityUpToLimit(3); 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 ScheduleActivityDecision(Identity.New(_activityName, _activityVersion, _positionalName)) })); }
public void Schedule_next_item_when_total_number_of_scheduling_events_exceeds_allowed_limit() { var workflow = new WorkflowToScheduleActivityUpToLimit(3); var completed1 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName); var completed2 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName); var completed3 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName); var completed4 = CreateCompletedActivityEventGraph(_activityName, _activityVersion, _positionalName); var historyEvents = new WorkflowHistoryEvents(completed4.Concat(completed3.Concat(completed2.Concat(completed1))), completed4.Last().EventId, completed4.First().EventId); var decisions = workflow.NewExecutionFor(historyEvents).Execute(); Assert.That(decisions, Is.EqualTo(new[] { new CompleteWorkflowDecision("completed") })); }