Esempio n. 1
0
        public void TestExtendedProps()
        {
            sync.SyncOption = SyncOption.MergeOutlookWins;

            // create new appointment to sync
            Outlook.AppointmentItem outlookAppointment = AppointmentsSynchronizer.CreateOutlookAppointmentItem(AppointmentsSynchronizer.SyncAppointmentsFolder);
            outlookAppointment.Subject     = name;
            outlookAppointment.Start       = DateTime.Now;
            outlookAppointment.Start       = DateTime.Now;
            outlookAppointment.AllDayEvent = true;

            outlookAppointment.Save();

            var googleAppointment = Factory.NewEvent();

            sync.appointmentsSynchronizer.UpdateAppointment(outlookAppointment, ref googleAppointment);

            Assert.AreEqual(name, googleAppointment.Summary);

            // read appointment from google
            googleAppointment = null;
            MatchAppointments(sync);
            AppointmentsMatcher.SyncAppointments(sync.appointmentsSynchronizer);

            AppointmentMatch match = FindMatch(outlookAppointment);

            Assert.IsNotNull(match);
            Assert.IsNotNull(match.GoogleAppointment);

            // get extended prop
            Assert.AreEqual(AppointmentPropertiesUtils.GetOutlookId(outlookAppointment), AppointmentPropertiesUtils.GetGoogleOutlookAppointmentId(sync.SyncProfile, match.GoogleAppointment));

            DeleteTestAppointments(match);
        }
Esempio n. 2
0
 private void DeleteTestAppointments(AppointmentMatch match)
 {
     if (match != null)
     {
         DeleteTestAppointment(match.GoogleAppointment);
         DeleteTestAppointment(match.OutlookAppointment);
     }
 }
        public void TestSync_Time()
        {
            sync.SyncOption = SyncOption.MergeOutlookWins;

            // create new appointment to sync
            Outlook.AppointmentItem outlookAppointment = Synchronizer.CreateOutlookAppointmentItem(Synchronizer.SyncAppointmentsFolder);
            outlookAppointment.Subject     = name;
            outlookAppointment.Start       = DateTime.Now;
            outlookAppointment.End         = DateTime.Now.AddHours(1);
            outlookAppointment.AllDayEvent = false;

            outlookAppointment.Save();


            sync.SyncOption = SyncOption.OutlookToGoogleOnly;

            var googleAppointment = Factory.NewEvent();

            sync.UpdateAppointment(outlookAppointment, ref googleAppointment);

            googleAppointment = null;

            sync.SyncOption = SyncOption.GoogleToOutlookOnly;
            //load the same appointment from google.
            MatchAppointments(sync);
            AppointmentMatch match = FindMatch(outlookAppointment);

            Assert.IsNotNull(match);
            Assert.IsNotNull(match.GoogleAppointment);
            Assert.IsNotNull(match.OutlookAppointment);

            Outlook.AppointmentItem recreatedOutlookAppointment = Synchronizer.CreateOutlookAppointmentItem(Synchronizer.SyncAppointmentsFolder);
            sync.UpdateAppointment(ref match.GoogleAppointment, recreatedOutlookAppointment, match.GoogleAppointmentExceptions);
            Assert.IsNotNull(outlookAppointment);
            Assert.IsNotNull(recreatedOutlookAppointment);
            // match recreatedOutlookAppointment with outlookAppointment

            Assert.AreEqual(outlookAppointment.Subject, recreatedOutlookAppointment.Subject);

            Assert.AreEqual(outlookAppointment.Start, recreatedOutlookAppointment.Start);
            Assert.AreEqual(outlookAppointment.End, recreatedOutlookAppointment.End);
            Assert.AreEqual(outlookAppointment.AllDayEvent, recreatedOutlookAppointment.AllDayEvent);
            //ToDo: Check other properties

            DeleteTestAppointments(match);
            recreatedOutlookAppointment.Delete();
        }