Пример #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);
        }
Пример #2
0
        public void TestRemoveOutlookDuplicatedAppointments_02()
        {
            sync.SyncOption = SyncOption.OutlookToGoogleOnly;

            // create new Outlook test appointment
            var ola1 = AppointmentsSynchronizer.CreateOutlookAppointmentItem(AppointmentsSynchronizer.SyncAppointmentsFolder);

            ola1.Subject     = name;
            ola1.Start       = DateTime.Now;
            ola1.End         = DateTime.Now.AddHours(1);
            ola1.AllDayEvent = false;
            ola1.ReminderSet = false;
            ola1.Save();

            // create new Google test appointments
            var e1 = Factory.NewEvent();

            sync.appointmentsSynchronizer.UpdateAppointment(ola1, ref e1);

            var ola2 = AppointmentsSynchronizer.CreateOutlookAppointmentItem(AppointmentsSynchronizer.SyncAppointmentsFolder);

            ola2.Subject     = name;
            ola2.Start       = DateTime.Now;
            ola2.End         = DateTime.Now.AddHours(1);
            ola2.AllDayEvent = false;
            ola2.ReminderSet = false;
            ola2.Save();
            sync.appointmentsSynchronizer.UpdateAppointment(ola2, ref e1);
            AppointmentPropertiesUtils.ResetGoogleOutlookAppointmentId(sync.SyncProfile, e1);
            e1 = sync.appointmentsSynchronizer.SaveGoogleAppointment(e1);

            var gid_ola1 = AppointmentPropertiesUtils.GetOutlookGoogleAppointmentId(sync.appointmentsSynchronizer, ola1);
            var gid_ola2 = AppointmentPropertiesUtils.GetOutlookGoogleAppointmentId(sync.appointmentsSynchronizer, ola2);
            var gid_e1   = AppointmentPropertiesUtils.GetGoogleId(e1);
            var oid_e1   = AppointmentPropertiesUtils.GetGoogleOutlookAppointmentId(sync.SyncProfile, e1);
            var oid_ola1 = AppointmentPropertiesUtils.GetOutlookId(ola1);
            var oid_ola2 = AppointmentPropertiesUtils.GetOutlookId(ola2);

            // assert ola1 points to e1
            Assert.AreEqual(gid_ola1, gid_e1);
            // assert ola2 points to e1
            Assert.AreEqual(gid_ola2, gid_e1);
            // assert appointment e1 does not point to ola1
            Assert.AreNotEqual(oid_e1, oid_ola1);
            // assert appointment e1 does not point to ola2
            Assert.AreNotEqual(oid_e1, oid_ola2);

            sync.appointmentsSynchronizer.LoadAppointments();

            var f_e1   = sync.appointmentsSynchronizer.GetGoogleAppointmentById(gid_e1);
            var f_ola1 = sync.appointmentsSynchronizer.GetOutlookAppointmentById(oid_ola1);
            var f_ola2 = sync.appointmentsSynchronizer.GetOutlookAppointmentById(oid_ola2);

            Assert.IsNotNull(f_e1);
            Assert.IsNotNull(f_ola1);
            Assert.IsNotNull(f_ola2);

            var f_gid_ola1 = AppointmentPropertiesUtils.GetOutlookGoogleAppointmentId(sync.appointmentsSynchronizer, f_ola1);
            var f_gid_ola2 = AppointmentPropertiesUtils.GetOutlookGoogleAppointmentId(sync.appointmentsSynchronizer, f_ola2);
            var f_gid_e1   = AppointmentPropertiesUtils.GetGoogleId(f_e1);
            var f_oid_e1   = AppointmentPropertiesUtils.GetGoogleOutlookAppointmentId(sync.SyncProfile, f_e1);
            var f_oid_ola1 = AppointmentPropertiesUtils.GetOutlookId(f_ola1);
            var f_oid_ola2 = AppointmentPropertiesUtils.GetOutlookId(f_ola2);

            // assert ola1 does not point to e1
            Assert.AreNotEqual(f_gid_ola1, f_gid_e1);
            // assert ola2 does not point to e1
            Assert.AreNotEqual(f_gid_ola2, f_gid_e1);
            // assert appointment e1 does not point to ola1
            Assert.AreNotEqual(f_oid_e1, f_oid_ola1);
            // assert appointment e1 does not point to ola2
            Assert.AreNotEqual(f_oid_e1, f_oid_ola2);

            DeleteTestAppointment(f_ola1);
            DeleteTestAppointment(f_ola2);
            DeleteTestAppointment(f_e1);
        }