public void GetDayInYear_DayOfMonth() { YearlyRecurrency yearly = new YearlyRecurrency(new DateTime(2011, 2, 01), new DateTime(2011, 11, 30), 1, 14, 3); Assert.AreEqual(MonthlyType.MonthDay, yearly.Type); Assert.AreEqual(14, yearly.Day); Assert.AreEqual(3, yearly.Month); Assert.AreEqual(new DateTime(2000, 3, 14), yearly.GetDayInYear(2000)); Assert.AreEqual(new DateTime(2011, 3, 14), yearly.GetDayInYear(2011)); Assert.AreEqual(new DateTime(2050, 3, 14), yearly.GetDayInYear(2050)); }
public void GetDayInYear_DayOfWeek() { YearlyRecurrency yearly = new YearlyRecurrency(new DateTime(2011, 2, 01), 6, 2, DayOfWeek.Tuesday, DayIndex.Second, 3); Assert.AreEqual(MonthlyType.Weekday, yearly.Type); Assert.AreEqual(DayOfWeek.Tuesday, yearly.DayOfWeek); Assert.AreEqual(DayIndex.Second, yearly.DayIndex); Assert.AreEqual(3, yearly.Month); // 2nd Tuesday in March Assert.AreEqual(new DateTime(2000, 3, 14), yearly.GetDayInYear(2000)); Assert.AreEqual(new DateTime(2011, 3, 8), yearly.GetDayInYear(2011)); Assert.AreEqual(new DateTime(2020, 3, 10), yearly.GetDayInYear(2020)); }