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); }
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); }
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); } }
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); }
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); }