Exemple #1
0
        public void Journal1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Journal\JOURNAL1.ics")[0];

            ProgramTest.TestCal(iCal);
            Assert.AreEqual(1, iCal.Journals.Count);
            IJournal j = iCal.Journals[0];

            Assert.IsNotNull(j, "Journal entry was null");
            Assert.AreEqual(JournalStatus.Draft, j.Status, "Journal entry should have been in DRAFT status, but it was in " + j.Status.ToString() + " status.");
            Assert.AreEqual("PUBLIC", j.Class, "Journal class should have been PUBLIC, but was " + j.Class + ".");
            Assert.IsNull(j.Start);
        }
        public void TestAlarm(string calendar, List <IDateTime> dates, iCalDateTime start, iCalDateTime end)
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Alarm\" + calendar)[0];

            ProgramTest.TestCal(iCal);
            IEvent evt = iCal.Events.First();

            // Poll all alarms that occurred between Start and End
            IList <AlarmOccurrence> alarms = evt.PollAlarms(start, end);

            foreach (AlarmOccurrence alarm in alarms)
            {
                Assert.IsTrue(dates.Contains(alarm.DateTime), "Alarm triggers at " + alarm.Period.StartTime + ", but it should not.");
            }
            Assert.IsTrue(dates.Count == alarms.Count, "There were " + alarms.Count + " alarm occurrences; there should have been " + dates.Count + ".");
        }
        public void TestTodoCompleted(string calendar, ArrayList items)
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\" + calendar)[0];

            ProgramTest.TestCal(iCal);
            ITodo todo = iCal.Todos[0];

            for (int i = 0; i < items.Count; i += 2)
            {
                IDateTime dt = (IDateTime)items[i];
                dt.TZID = tzid;

                bool tf = (bool)items[i + 1];
                if (tf)
                {
                    Assert.IsTrue(todo.IsCompleted(dt), "Todo should be completed at " + dt);
                }
                else
                {
                    Assert.IsFalse(todo.IsCompleted(dt), "Todo should not be completed at " + dt);
                }
            }
        }