public void Given_reoccurring_task_that_has_gone_past_last_end_date_When_get_schedule_Then_returns_correct_schedule() { //Given var task = new MultiHazardRiskAssessmentFurtherControlMeasureTask { TaskReoccurringType = TaskReoccurringType.Weekly, TaskReoccurringEndDate = DateTime.Today.AddDays(-1)}; //When var result = task.GetReoccurringSchedule(); //Then Assert.That(result.ScheduledDates.Count(), Is.EqualTo(0)); }
public void Given_not_reoccurring_task_When_get_schedule_Then_returns_correct_schedule() { //Given var task = new MultiHazardRiskAssessmentFurtherControlMeasureTask {TaskReoccurringType = TaskReoccurringType.None}; //When var result = task.GetReoccurringSchedule(); //Then Assert.That(result.ScheduledDates.Count(), Is.EqualTo(0)); }
public void ReoccuringScheduleOnlyCalculatesScheduleWithinBoundsOfTasksRecurringStartAndEndDates() { // Given var task = new MultiHazardRiskAssessmentFurtherControlMeasureTask { TaskStatus = TaskStatus.Outstanding, TaskReoccurringType = TaskReoccurringType.Weekly, TaskCompletionDueDate = new DateTime(2080, 6, 23), TaskReoccurringEndDate = new DateTime(2080, 7, 23) }; // When var result = task.GetReoccurringSchedule(); // Then Assert.That(result.ScheduledDates.Count(), Is.EqualTo(5)); }
public void ReoccuringScheduleReturnsAtMostFiveResults() { // Given var task = new MultiHazardRiskAssessmentFurtherControlMeasureTask { TaskStatus = TaskStatus.Outstanding, TaskReoccurringType = TaskReoccurringType.Weekly, TaskCompletionDueDate = new DateTime(2080, 6, 23), TaskReoccurringEndDate = new DateTime(2080, 12, 23) }; // When var result = task.GetReoccurringSchedule(); // Then Assert.That(result.ScheduledDates.Count(), Is.EqualTo(5)); }
public void Given_monthly_reoccurring_task_that_has_no_last_end_date_When_get_schedule_Then_returns_correct_schedule_with_five_dates() { //Given var task = new MultiHazardRiskAssessmentFurtherControlMeasureTask { TaskReoccurringType = TaskReoccurringType.Monthly, TaskCompletionDueDate = DateTime.Today }; //When var result = task.GetReoccurringSchedule(); //Then Assert.That(result.ScheduledDates.Count(), Is.EqualTo(5)); Assert.That(result.ScheduledDates.First(), Is.EqualTo(DateTime.Today.ToShortDateString())); Assert.That(result.ScheduledDates.Skip(1).Take(1).First(), Is.EqualTo(DateTime.Today.AddMonths(1).ToShortDateString())); Assert.That(result.ScheduledDates.Skip(2).Take(1).First(), Is.EqualTo(DateTime.Today.AddMonths(2).ToShortDateString())); Assert.That(result.ScheduledDates.Skip(3).Take(1).First(), Is.EqualTo(DateTime.Today.AddMonths(3).ToShortDateString())); Assert.That(result.ScheduledDates.Skip(4).Take(1).First(), Is.EqualTo(DateTime.Today.AddMonths(4).ToShortDateString())); }