Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
            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);
            }
Beispiel #3
0
 private CalendarMonth convertPageIndexToCalendarMonth(int pageIndex)
 => initialMonth.AddMonths(pageIndex);