public void CalculatedRecurrenceSetFilteringWorks()
            {
                #region Arrange

                var validStartDateTime = new DateTime(2014, 2, 17);
                const int validWeeksBetweenOccurrences = 1;
                var validIncludedWeekDays = new List<DayOfWeek>
                {
                    DayOfWeek.Monday,
                    DayOfWeek.Wednesday,
                    DayOfWeek.Saturday
                };
                // end on Saturday two weeks from the start date
                DateTime validEndDateTime =
                    validStartDateTime.AddDays(DayOfWeek.Saturday - DayOfWeek.Monday).AddDays(7*2);
                var validWeeklyRecurrence = new WeeklyRecurrence(validStartDateTime, validWeeksBetweenOccurrences,
                    validIncludedWeekDays, validEndDateTime);

                var expectedRecurrenceSet = new List<DateTime>
                {
                    // DateTimes from first occurrence
                    validStartDateTime.AddDays(DayOfWeek.Wednesday - DayOfWeek.Monday),
                    validStartDateTime.AddDays(DayOfWeek.Saturday - DayOfWeek.Monday),
                    // DateTimes from second occurrence
                    validStartDateTime.AddDays(7*2),
                    validStartDateTime.AddDays(DayOfWeek.Wednesday - DayOfWeek.Monday).AddDays(7*2)
                };

                #endregion

                #region Act

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

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

                #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
            }
            public void CalculatedRecurrenceSetFilteringWorks()
            {
                #region Arrange

                var validStartDateTime = new DateTime(2014, 2, 19);
                const int validYearsBetweenOccurrences = 2;
                DateTime validEndDateTime = validStartDateTime.AddYears(6);
                var validYearlyRecurrence = new YearlyRecurrence(validStartDateTime, validYearsBetweenOccurrences,
                    validEndDateTime);

                #endregion

                #region Act

                var validDateTimeWindow = new DateTimeWindow(validStartDateTime + TimeSpan.FromDays(1),
                    validEndDateTime - TimeSpan.FromDays(1));

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

                #endregion

                #region Assert

                var expectedRecurrenceSet = new List<DateTime>
                {
                    validStartDateTime.AddYears(validYearsBetweenOccurrences*1),
                    validStartDateTime.AddYears(validYearsBetweenOccurrences*2)
                };

                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 validDayOfMonthMonthlyRecurrence = new DayOfMonthMonthlyRecurrence(validStartDateTime,
                    validMonthsBetweenOccurrences, validEndDateTime);

                var expectedRecurrenceSet = new List<DateTime>
                {
                    validStartDateTime.AddMonths(2), // 3/31/2014 (March)
                    validStartDateTime.AddMonths(4), // 5/31/2014 (May)
                    validStartDateTime.AddMonths(6) // 7/31/2014 (July)
                };

                #endregion

                #region Act

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

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

                #endregion

                #region Assert

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

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

                var validStartDateTime = new DateTime(2014, 2, 18);
                const int validDaysBetweenOccurrences = 3;
                var validEndDateTime = validStartDateTime.AddDays(9);
                var validDailyRecurrence = new DailyRecurrence(validStartDateTime, validDaysBetweenOccurrences,
                    validEndDateTime);

                #endregion

                #region Act

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

                var recurrenceSet =
                    validDailyRecurrence.CalculateRecurrenceSet(dateTimeWindow: validDateTimeWindow);

                #endregion

                #region Assert

                var expectedRecurrenceSet = new List<DateTime>
                {
                    validStartDateTime.AddDays(validDaysBetweenOccurrences*1),
                    validStartDateTime.AddDays(validDaysBetweenOccurrences*2)
                };

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

                #endregion
            }