public void Convert_MonthlyPatternDayBasedWithOutOccurencesWithInterval_EndDateConsidered()
        {
            var rule = DateTimeRecurrenceRuleConverterTypes.RecurrenceRule.Create(
                DateTimeRecurrenceRuleConverterTypes.RecurrencePatternTypes.Monthly,
                2,
                new DateTimeOffset(new DateTime(2018, 10, 01, 13, 0, 0)),
                new DateTimeOffset(new DateTime(2018, 12, 31, 14, 0, 0)),
                null,
                null,
                new DateTimeRecurrenceRuleConverterTypes.MonthlyRecurrencePattern(10, null, null));
            var expected = new[]
            {
                new DateTime(2018, 10, 10),
                new DateTime(2018, 12, 10),
            };

            var result = DateTimeRecurrenceRuleConverter.Convert(rule).ToArray();

            CollectionAssert.AreEquivalent(expected, result);
        }
        public void Convert_DailyPatternWithOccurencesWithInterval_EndDateIgnored()
        {
            var rule = DateTimeRecurrenceRuleConverterTypes.RecurrenceRule.Create(
                DateTimeRecurrenceRuleConverterTypes.RecurrencePatternTypes.Daily,
                2,
                new DateTimeOffset(new DateTime(2018, 10, 01, 13, 0, 0)),
                new DateTimeOffset(new DateTime(2018, 10, 04, 14, 0, 0)),
                2,
                null,
                null);

            var expected = new[]
            {
                new DateTime(2018, 10, 01),
                new DateTime(2018, 10, 03)
            };

            var result = DateTimeRecurrenceRuleConverter.Convert(rule).ToArray();

            CollectionAssert.AreEquivalent(expected, result);
        }
        public void Convert_EveryWeekDayPatternWithOutOccurences_EndDateConsidered()
        {
            var rule = DateTimeRecurrenceRuleConverterTypes.RecurrenceRule.Create(
                DateTimeRecurrenceRuleConverterTypes.RecurrencePatternTypes.EveryWeekDay,
                null,
                new DateTimeOffset(new DateTime(2018, 10, 05, 13, 0, 0)),
                new DateTimeOffset(new DateTime(2018, 10, 08, 14, 0, 0)),
                2,
                null,
                null);

            var expected = new[]
            {
                new DateTime(2018, 10, 05),
                new DateTime(2018, 10, 08),
            };

            var result = DateTimeRecurrenceRuleConverter.Convert(rule).ToArray();

            CollectionAssert.AreEquivalent(expected, result);
        }
        public void Convert_MonthlyPatternDayBasedWithOutOccurences31DayRequested_TakeLastDayOfEveryMonth()
        {
            var rule = DateTimeRecurrenceRuleConverterTypes.RecurrenceRule.Create(
                DateTimeRecurrenceRuleConverterTypes.RecurrencePatternTypes.Monthly,
                2,
                new DateTimeOffset(new DateTime(2018, 10, 01, 13, 0, 0)),
                new DateTimeOffset(new DateTime(2018, 12, 31, 14, 0, 0)),
                null,
                null,
                new DateTimeRecurrenceRuleConverterTypes.MonthlyRecurrencePattern(31, null, null));

            var expected = new[]
            {
                new DateTime(2018, 10, 31),
                new DateTime(2018, 11, 30),
                new DateTime(2018, 12, 31),
            };

            var result = DateTimeRecurrenceRuleConverter.Convert(rule).ToArray();

            CollectionAssert.AreEquivalent(expected, result);
        }
        public void Convert_MonthlyPatternWeekBasedWithOutOccurencesWithIntervalSecondWednesdayRequested_EndDateConsidered()
        {
            var rule = DateTimeRecurrenceRuleConverterTypes.RecurrenceRule.Create(
                DateTimeRecurrenceRuleConverterTypes.RecurrencePatternTypes.Monthly,
                2,
                new DateTimeOffset(new DateTime(2018, 10, 01, 13, 0, 0)),
                new DateTimeOffset(new DateTime(2018, 12, 31, 14, 0, 0)),
                null,
                null,
                new DateTimeRecurrenceRuleConverterTypes.MonthlyRecurrencePattern(
                    null,
                    new FSharpOption <DateTimeRecurrenceRuleConverterTypes.WeekOfMonthTypes>(DateTimeRecurrenceRuleConverterTypes.WeekOfMonthTypes.Second),
                    new FSharpOption <DateTimeRecurrenceRuleConverterTypes.DayOfWeekTypes>(DateTimeRecurrenceRuleConverterTypes.DayOfWeekTypes.Wednesday)));
            var expected = new[]
            {
                new DateTime(2018, 10, 10),
                new DateTime(2018, 12, 12),
            };

            var result = DateTimeRecurrenceRuleConverter.Convert(rule).ToArray();

            CollectionAssert.AreEquivalent(expected, result);
        }