public void CalculatedRecurrenceSetPagingWorks()
            {
                #region Arrange

                var validStartDateTime = new DateTime(2014, 1, 31);
                const int validMonthsBetweenOccurrences = 2;
                DateTime validEndDateTime = validStartDateTime.AddMonths(9);
                var validDayOfWeekMonthlyRecurrence = new DayOfWeekMonthlyRecurrence(validStartDateTime,
                    validMonthsBetweenOccurrences, validEndDateTime);

                var expectedRecurrenceSet = new List<DateTime>
                {
                    new DateTime(2014, 3, 28), // 3/28/2014 (March)
                    new DateTime(2014, 5, 30), // 5/30/2014 (May)
                };

                #endregion

                #region Act

                const int validSkip = 1;
                const int validTake = 2;
                IEnumerable<DateTime> recurrenceSet = validDayOfWeekMonthlyRecurrence.CalculateRecurrenceSet(validSkip,
                    validTake);

                #endregion

                #region Assert

                Assert.IsTrue(expectedRecurrenceSet.SequenceEqual(recurrenceSet));

                #endregion
            }
            public void CanCalculateRecurrenceSet()
            {
                #region Arrange

                var validStartDateTime = new DateTime(2014, 1, 31);
                const int validMonthsBetweenOccurrences = 2;
                DateTime validEndDateTime = validStartDateTime.AddMonths(9);
                var validDayOfWeekMonthlyRecurrence = new DayOfWeekMonthlyRecurrence(validStartDateTime,
                    validMonthsBetweenOccurrences, validEndDateTime);

                var expectedRecurrenceSet = new List<DateTime>
                {
                    new DateTime(2014, 1, 31), // 1/31/2014 (January)
                    new DateTime(2014, 3, 28), // 3/28/2014 (March)
                    new DateTime(2014, 5, 30), // 5/30/2014 (May)
                    new DateTime(2014, 7, 25), // 7/25/2014 (July)
                    new DateTime(2014, 9, 26) // 9/26/2014 (September)
                };

                #endregion

                #region Act

                IEnumerable<DateTime> recurrenceSet = validDayOfWeekMonthlyRecurrence.CalculateRecurrenceSet();

                #endregion

                #region Assert

                Assert.IsTrue(expectedRecurrenceSet.SequenceEqual(recurrenceSet));

                #endregion
            }
            public void CalculatedRecurrenceSetFilteringWorks()
            {
                #region Arrange

                var validStartDateTime = new DateTime(2014, 1, 31);
                const int validMonthsBetweenOccurrences = 2;
                DateTime validEndDateTime = validStartDateTime.AddMonths(9);
                var validDayOfWeekMonthlyRecurrence = new DayOfWeekMonthlyRecurrence(validStartDateTime,
                    validMonthsBetweenOccurrences, validEndDateTime);

                var expectedRecurrenceSet = new List<DateTime>
                {
                    new DateTime(2014, 3, 28), // 3/28/2014 (March)
                    new DateTime(2014, 5, 30), // 5/30/2014 (May)
                    new DateTime(2014, 7, 25), // 7/25/2014 (July)
                    new DateTime(2014, 9, 26) // 9/26/2014 (September)
                };

                #endregion

                #region Act

                var validDateTimeWindow = new DateTimeWindow(validStartDateTime.AddDays(1),
                    validEndDateTime.Subtract(TimeSpan.FromDays(1)));

                IEnumerable<DateTime> recurrenceSet =
                    validDayOfWeekMonthlyRecurrence.CalculateRecurrenceSet(dateTimeWindow: validDateTimeWindow);

                #endregion

                #region Assert

                Assert.IsTrue(expectedRecurrenceSet.SequenceEqual(recurrenceSet));

                #endregion
            }