public void TestCreateAGoogleContact()
        {
            GContactSync.Contact c = new GContactSync.Contact("John Doe");
            c.addMail("*****@*****.**");

            GoogleContactDownloader gcd = new GoogleContactDownloader(GoogleContactDownloader.TestUser, GoogleContactDownloader.TestPass);
            int oldCount = gcd.GetContacts().Count();

            IContact gc = gcd.NewContact(c);
            gc.Update();

            Assert.AreEqual(gcd.GetContacts().Count(), oldCount + 1);
        }
示例#2
0
        private void GetAllContactsAndMergeThem()
        {
            string user;
            string pass;
            UserCredentials dialog = new UserCredentials();
            if (!UserCredentialsAsker.GetUserCredentials(dialog, out user, out pass)) {
                return;
            }

            GoogleContactDownloader gcd = new GoogleContactDownloader(user, pass);
            OContactManager ocm = new OContactManager(this.Application);
            List<IContact> l1 = new List<IContact>();
            List<IContact> l2 = new List<IContact>();
            l1.AddRange(gcd.GetContacts());
            l2.AddRange(ocm.GetContacts());
            System.Windows.Forms.MessageBox.Show("Starting merge...");
            ContactMerger.Merge(gcd, ocm, l1, l2);
            System.Windows.Forms.MessageBox.Show("Done!");
        }
示例#3
0
        private void GetAllContactsAndMergeThem()
        {
            string          user;
            string          pass;
            UserCredentials dialog = new UserCredentials();

            if (!UserCredentialsAsker.GetUserCredentials(dialog, out user, out pass))
            {
                return;
            }

            GoogleContactDownloader gcd = new GoogleContactDownloader(user, pass);
            OContactManager         ocm = new OContactManager(this.Application);
            List <IContact>         l1  = new List <IContact>();
            List <IContact>         l2  = new List <IContact>();

            l1.AddRange(gcd.GetContacts());
            l2.AddRange(ocm.GetContacts());
            System.Windows.Forms.MessageBox.Show("Starting merge...");
            ContactMerger.Merge(gcd, ocm, l1, l2);
            System.Windows.Forms.MessageBox.Show("Done!");
        }
        public void testMergeWithGoogle()
        {
            try
            {
                GoogleContactDownloader gcd = new GoogleContactDownloader(GoogleContactDownloader.TestUser, GoogleContactDownloader.TestPass);

                IContact c1 = new GContactSync.Contact("John Doe", "*****@*****.**");
                IContactManager m1 = new MockContactManager
                {
                    GetContactsImpl = () =>
                    {
                        var l = new List<IContact>();
                        l.Add(c1);
                        return l;
                    }

                };
                IEnumerable<IContact> googleContacts = gcd.GetContacts();
                googleContacts = googleContacts.Where(c => c.FullName != null && c.FullName.Contains("Doe"));

                ContactMerger.Merge(gcd, m1, googleContacts, m1.GetContacts());
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }