示例#1
0
 public void SetUp()
 {
     sync             = new Syncronizer();
     sync.SyncProfile = "test profile";
     sync.LoginToGoogle(ConfigurationManager.AppSettings["Gmail.Username"], ConfigurationManager.AppSettings["Gmail.Password"]);
     sync.LoginToOutlook();
     sync.Load();
 }
示例#2
0
 public void SetUp()
 {
     sync = new Syncronizer();
     sync.SyncProfile = "test profile";
     sync.LoginToGoogle(ConfigurationManager.AppSettings["Gmail.Username"], ConfigurationManager.AppSettings["Gmail.Password"]);
     sync.LoginToOutlook();
     sync.Load();
 }
示例#3
0
        public void TestSync()
        {
            sync.SyncOption = SyncOption.MergeOutlookWins;

            string timestamp = DateTime.Now.Ticks.ToString();
            string name      = "AN OUTLOOK TEST CONTACT";
            string email     = "*****@*****.**";

            name = name.Replace(" ", "_");

            // delete previously failed test contacts
            DeleteExistingTestContacts(name, email);

            sync.Load();
            ContactsMatcher.SyncContacts(sync);

            // create new contact to sync
            Outlook.ContactItem outlookContact = sync.OutlookApplication.CreateItem(Outlook.OlItemType.olContactItem) as Outlook.ContactItem;
            outlookContact.FullName               = name;
            outlookContact.FileAs                 = name;
            outlookContact.Email1Address          = email;
            outlookContact.Email2Address          = email.Replace("00", "01");
            outlookContact.Email3Address          = email.Replace("00", "02");
            outlookContact.HomeAddress            = "10 Parades";
            outlookContact.PrimaryTelephoneNumber = "123";
            outlookContact.Save();

            ContactEntry googleContact = new ContactEntry();

            ContactSync.UpdateContact(outlookContact, googleContact);
            ContactMatch match = new ContactMatch(outlookContact, googleContact);

            //save contact to google.
            sync.SaveGoogleContact(match);
            googleContact = null;

            //load the same contact from google.
            sync.Load();
            ContactsMatcher.SyncContacts(sync);
            match = sync.ContactByProperty(name, email);

            Outlook.ContactItem recreatedOutlookContact = sync.OutlookApplication.CreateItem(Outlook.OlItemType.olContactItem) as Outlook.ContactItem;
            ContactSync.MergeContacts(match.GoogleContact, recreatedOutlookContact);

            // match recreatedOutlookContact with outlookContact
            Assert.AreEqual(outlookContact.FullName, recreatedOutlookContact.FullName);
            Assert.AreEqual(outlookContact.FileAs, recreatedOutlookContact.FileAs);
            Assert.AreEqual(outlookContact.Email1Address, recreatedOutlookContact.Email1Address);
            Assert.AreEqual(outlookContact.Email2Address, recreatedOutlookContact.Email2Address);
            Assert.AreEqual(outlookContact.Email3Address, recreatedOutlookContact.Email3Address);
            Assert.AreEqual(outlookContact.PrimaryTelephoneNumber, recreatedOutlookContact.PrimaryTelephoneNumber);
            Assert.AreEqual(outlookContact.HomeAddress, recreatedOutlookContact.HomeAddress);

            //delete test contacts
            match.Delete();
        }