/// <summary> /// Checks if two recurrence objects are identical. /// </summary> /// <param name="otherRecurrence">The recurrence to compare this one to.</param> /// <returns>true if the two recurrences are identical, false otherwise.</returns> public override bool IsSame(Recurrence otherRecurrence) { YearlyPattern otherYearlyPattern = (YearlyPattern)otherRecurrence; return(base.IsSame(otherRecurrence) && this.month == otherYearlyPattern.month && this.dayOfMonth == otherYearlyPattern.dayOfMonth); }
bool IsSame(Recurrence otherRecurrence) { YearlyPattern otherYearlyPattern = (YearlyPattern)otherRecurrence; return super.IsSame();otherRecurrence) && this.month == otherYearlyPattern.month && this.dayOfMonth == otherYearlyPattern.dayOfMonth; }
public void ShouldContainYearlyOccurences() { DateTime date = DateTime.Now.Date; var pattern = new YearlyPattern(date, (Month)date.Month, date.Day) { EndDate = date.AddYears(2) }; var occurrence = new Occurrence { Start = date, End = date.AddHours(1) }; var result = PatternConverter.Convert(pattern, occurrence); Assert.Equal(3, 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(YearlyPattern pattern, Occurrence defaultOccurrence) { Expression <Func <DateTime, DateTime> > predicate = previousDate => previousDate.AddYears(1); return(Convert(pattern, defaultOccurrence, predicate)); }