Пример #1
0
        public void Todo7_1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\Todo7.ics")[0];
            ITodo      todo = iCal.Todos[0];

            ArrayList items = new ArrayList();

            items.Add(new iCalDateTime(2006, 7, 28, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 8, 4, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 9, 1, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 10, 6, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 11, 3, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 12, 1, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 1, 5, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 2, 2, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 3, 2, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 4, 6, 9, 0, 0, tzid));

            IList <Occurrence> occurrences = todo.GetOccurrences(
                new iCalDateTime(2006, 7, 1, 9, 0, 0),
                new iCalDateTime(2007, 7, 1, 9, 0, 0));

            // FIXME: Count is not properly restricting recurrences to 10.
            // What's going wrong here?
            Assert.AreEqual(
                items.Count,
                occurrences.Count,
                "TODO should have " + items.Count + " occurrences; it has " + occurrences.Count);

            for (int i = 0; i < items.Count; i++)
            {
                Assert.AreEqual(items[i], occurrences[i].Period.StartTime, "TODO should occur at " + items[i] + ", but does not.");
            }
        }