public void TestTodoActive(string calendar, ArrayList items, params int[] numPeriods) { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\" + calendar); ProgramTest.TestCal(iCal); DDay.iCal.Components.Todo todo = (DDay.iCal.Components.Todo)iCal.Todos[0]; for (int i = 0; i < items.Count; i += 2) { iCalDateTime dt = (iCalDateTime)items[i]; dt.iCalendar = iCal; dt.TZID = tzid; bool tf = (bool)items[i + 1]; if (tf) { Assert.IsTrue(todo.IsActive(dt), "Todo should be active at " + dt); } else { Assert.IsFalse(todo.IsActive(dt), "Todo should not be active at " + dt); } } if (numPeriods != null && numPeriods.Length > 0) { Assert.AreEqual( numPeriods[0], todo.Periods.Count, "Todo should have " + numPeriods[0] + " occurrences after evaluation; it had " + todo.Periods.Count); } }
public void TestTodoActive(string calendar, ArrayList items) { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\" + calendar); Program.TestCal(iCal); DDay.iCal.Components.Todo todo = (DDay.iCal.Components.Todo)iCal.Todos[0]; todo.Evaluate(new Date_Time(2006, 7, 28, tzid, iCal), new Date_Time(2010, 1, 1, tzid, iCal)); for (int i = 0; i < items.Count; i += 2) { Date_Time dt = (Date_Time)items[i]; dt.iCalendar = iCal; dt.TZID = tzid; bool tf = (bool)items[i + 1]; if (tf) { Assert.IsTrue(todo.IsActive(dt), "Todo should be active at " + dt); } else { Assert.IsFalse(todo.IsActive(dt), "Todo should not be active at " + dt); } } }