コード例 #1
0
ファイル: CalendarTest.cs プロジェクト: datttit/SyncMLDotNet
        public void TestAddCalendarICal()
        {
            string                  x            = File.ReadAllText(MockPath + "Outlook demo event.ics");
            Application             app          = new Application();
            OutlookCalendarWithICal agent        = new OutlookCalendarWithICal(app);
            OutlookCalendar         outlookAgent = new OutlookCalendar(app, CalendarPeriod.All);

            string entryId = outlookAgent.GetEntryIdByDisplayName(iCalSubject);

            if (entryId != null)
            {
                bool deletionOK = outlookAgent.DeleteItem(entryId);
                Assert.IsTrue(deletionOK);
            }
            agent.AddItem(x); //also test ReadTextToItem()
            entryId = outlookAgent.GetEntryIdByDisplayName(iCalSubject);
            Assert.IsTrue(entryId != null);

            AppointmentItem appointment = outlookAgent.GetItemByEntryId(entryId);

            var calendarCollection = iCalendar.LoadFromFile(MockPath + "Outlook demo event.ics");
            var calendar           = calendarCollection.FirstOrDefault();
            var icalEvent          = calendar.Events[0];

            CompareIcalEventAndAppointment(icalEvent, appointment);
        }
コード例 #2
0
ファイル: CalendarTest.cs プロジェクト: datttit/SyncMLDotNet
        string AddCalendar()
        {
            XElement                x            = XElement.Load(MockPath + "SifE.xml");
            Application             app          = new Application();
            OutlookCalendarWithSifE agent        = new OutlookCalendarWithSifE(app);
            OutlookCalendar         outlookAgent = new OutlookCalendar(app, CalendarPeriod.All);

            string entryId = outlookAgent.GetEntryIdByDisplayName(subject);

            if (entryId != null)
            {
                bool deletionOK = outlookAgent.DeleteItem(entryId);
                Assert.IsTrue(deletionOK);
            }
            agent.AddItem(x.ToString());
            entryId = outlookAgent.GetEntryIdByDisplayName(subject);
            Assert.IsTrue(entryId != null);
            return(entryId);
        }