示例#1
0
        public void DeleteContact()
        {
            app.Nav.OpenContactPage();
            List <ContactInfo> oldContacts = new List <ContactInfo>();

            oldContacts = ContactInfo.GetAllContactsFromDb();
            ContactInfo toBeDeleted = oldContacts[0];

            if (!app.ContactsWorker.CheckAtLeastOneContactExists())
            {
                CreateContact(null);
            }
            app.Nav.OpenContactPage();

            app.ContactsWorker.Delete(toBeDeleted);
            oldContacts.Remove(toBeDeleted);
            app.Nav.OpenContactPage();

            List <ContactInfo> newContacts = new List <ContactInfo>();

            newContacts = ContactInfo.GetAllContactsFromDb();
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
示例#2
0
        public void ModifyAContact()
        {
            ContactInfo modifiedContact = new ContactInfo("FirstModified2", "LastModified2");

            app.Nav.OpenContactPage();
            List <ContactInfo> oldContacts = new List <ContactInfo>();

            oldContacts = ContactInfo.GetAllContactsFromDb();

            if (!app.ContactsWorker.CheckAtLeastOneContactExists())
            {
                CreateContact(null);
            }
            app.Nav.OpenContactPage();
            app.ContactsWorker.Modify(int.Parse(oldContacts[0].Id), modifiedContact);
            app.Nav.OpenContactPage();

            List <ContactInfo> newContacts = new List <ContactInfo>();

            newContacts = ContactInfo.GetAllContactsFromDb();
            oldContacts[0].FirstName = modifiedContact.FirstName;
            oldContacts[0].LastName  = modifiedContact.LastName;

            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
示例#3
0
 public void CompareContactsUiDb()
 {
     if (ENABLED_DETAILED_CHECKS)
     {
         List <ContactInfo> fromUi = app.ContactsWorker.GetContactsList();
         List <ContactInfo> fromDb = ContactInfo.GetAllContactsFromDb();
         fromUi.Sort();
         fromDb.Sort();
         Assert.AreEqual(fromUi, fromDb);
     }
 }
示例#4
0
        public void AddingAContactToGroup()
        {
            //select a group and save old data
            GroupInfo          group   = GroupInfo.GetAllGroupsFromDb()[0];
            List <ContactInfo> oldList = group.GetContacts();
            ContactInfo        cont    = ContactInfo.GetAllContactsFromDb().Except(oldList).First();

            //actions
            app.ContactsWorker.AddContactToGroup(cont, group);

            List <ContactInfo> newList = group.GetContacts();

            oldList.Add(cont);
            newList.Sort();
            oldList.Sort();
            Assert.AreEqual(oldList, newList);
        }
示例#5
0
        public void CreateContact(ContactInfo contact)
        {
            List <ContactInfo> oldContacts = new List <ContactInfo>();

            oldContacts = ContactInfo.GetAllContactsFromDb();

            if (contact == null)
            {
                contact = new ContactInfo("TheFirstName", "TheLastName");
            }

            app.Nav.OpenNewContactPage();
            app.ContactsWorker.FillinContactData(contact);

            List <ContactInfo> newContacts = new List <ContactInfo>();

            newContacts = ContactInfo.GetAllContactsFromDb();
            oldContacts.Add(contact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }