Esempio n. 1
0
        public void ContactModification()
        {
            var       newData = new ContactBuilder().Build();
            const int contactToModifyIndex = 1;

            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();
            ContactFormData        oldData     = oldContacts[0];

            app.Contacts.Modify(newData, oldData);

            Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount());

            oldContacts[0].Lastname  = newData.Lastname;
            oldContacts[0].Firstname = newData.Firstname;
            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

            oldContacts.Sort();
            newContacts.Sort();

            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactFormData contact in newContacts)
            {
                if (contact.Id == oldData.Id)
                {
                    Assert.AreEqual(newData.Lastname, contact.Lastname);
                    Assert.AreEqual(newData.Firstname, contact.Firstname);
                }
            }
        }
Esempio n. 2
0
 public void CompareContactsUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <ContactFormData> fromUI = app.Contacts.GetContactList();
         List <ContactFormData> fromDB = ContactFormData.GetAllContacts();
         fromDB.Sort();
         fromUI.Sort();
         Assert.AreEqual(fromDB, fromUI);
     }
 }
Esempio n. 3
0
        public void TestDBConnectivity()
        {
            DateTime start = DateTime.Now;
            List <ContactFormData> fromUi = app.Contacts.GetContactList();
            DateTime finish = DateTime.Now;

            System.Console.Out.WriteLine(finish.Subtract(start));

            start = DateTime.Now;
            List <ContactFormData> fromDB = ContactFormData.GetAllContacts();

            finish = DateTime.Now;
            System.Console.Out.WriteLine(finish.Subtract(start));
        }
Esempio n. 4
0
        public void NewContact()
        {
            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();

            var newContact = new ContactBuilder().Build();

            app.Contacts.Create(newContact);

            Assert.AreEqual(oldContacts.Count + 1, app.Contacts.GetContactCount());

            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

            oldContacts.Add(newContact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
Esempio n. 5
0
        public void ContactRemove()
        {
            const int contactToRemoveIndex = 1;

            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();
            ContactFormData        toBeRemoved = oldContacts[0];

            app.Contacts.Remove(toBeRemoved);

            Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount());

            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

            oldContacts.RemoveAt(0);
            oldContacts.Sort();
            newContacts.Sort();

            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactFormData contact in newContacts)
            {
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }