private void addDaysFromNextMonth() { var lastDayOfWeekInTargetMonth = (int)CalendarMonth .DayOfWeek(CalendarMonth.DaysInMonth); var nextMonth = CalendarMonth.AddMonths(1); var lastDayOfWeek = ((int)beginningOfWeek + 6) % 7; var daysToAdd = (lastDayOfWeek - lastDayOfWeekInTargetMonth + 7) % 7; for (int i = 0; i < daysToAdd; i++) { addDay(i + 1, nextMonth, false); } }
public void WorksForNegativeNumberOfMonths( int initialYear, int initialMonth, int monthsToAdd, int expectedYear, int expectedMonth) { var initialCalendarMonth = new CalendarMonth(initialYear, initialMonth); var result = initialCalendarMonth.AddMonths(monthsToAdd); result.Year.Should().Be(expectedYear); result.Month.Should().Be(expectedMonth); }
private CalendarMonth convertPageIndexToCalendarMonth(int pageIndex) => initialMonth.AddMonths(pageIndex);