public void DatesOnDayInMonthInRange_should_return_a_single_date_if_given_a_small_range() { var dateRange = new DateRange(start: new DateTime(2020, 1, 1), end: new DateTime(2020, 1, 5)); var dates = dateRange.DatesOnDayInMonthInRange(5).ToList(); Assert.Single(dates); dates = dateRange.DatesOnDayInMonthInRange(1).ToList(); Assert.Single(dates); }
public void DatesOnDayInMonthInRange_should_return_empty_if_given_a_small_date_range_not_containing_the_date() { var dateRange = new DateRange(start: new DateTime(2020, 1, 1), end: new DateTime(2020, 1, 5)); var dates = dateRange.DatesOnDayInMonthInRange(31).ToList(); Assert.Empty(dates); }
public void DatesOnDayInMonthInRange_should_handle_dates_that_dont_exist_in_some_months() { var dateRange = new DateRange(start: new DateTime(2020, 1, 10), end: new DateTime(2020, 4, 5)); var dates = dateRange.DatesOnDayInMonthInRange(31).ToList(); Assert.Contains(new DateTime(2020, 1, 31), dates); Assert.Contains(new DateTime(2020, 3, 31), dates); Assert.Equal(2, dates.Count); }
public void DatesOnDayInMonthInRange_should_return_correct_dates() { var dateRange = new DateRange(start: new DateTime(2020, 1, 10), end: new DateTime(2020, 4, 5)); var dates = dateRange.DatesOnDayInMonthInRange(1).ToList(); Assert.Contains(new DateTime(2020, 2, 1), dates); Assert.Contains(new DateTime(2020, 3, 1), dates); Assert.Contains(new DateTime(2020, 4, 1), dates); Assert.Equal(3, dates.Count); }