public void ShouldContainMonthlyOccurences() { DateTime date = DateTime.Now.Date; var pattern = new MonthlyPattern(date, 1, DateTime.Now.Day) { EndDate = date.AddDays(45) }; var occurrence = new Occurrence { Start = date, End = date.AddHours(1) }; var result = PatternConverter.Convert(pattern, occurrence); Assert.Equal(2, result.Count); Assert.Equal(date, result.First().Start); }
/// <summary> /// Converts the specified pattern. /// </summary> /// <param name="pattern">The pattern.</param> /// <param name="defaultOccurrence">The default occurrence.</param> /// <returns></returns> public static OccurrenceCollection Convert(MonthlyPattern pattern, Occurrence defaultOccurrence) { Expression <Func <DateTime, DateTime> > predicate = previousDate => previousDate.AddMonths(pattern.Interval); return(Convert(pattern, defaultOccurrence, predicate)); }