public void TestAddingContactToGroup() { //if a group is present if (!app.Groups.IsGroupPresent()) { GroupData newGroup = new GroupData("test1"); newGroup.Header = "header"; newGroup.Footer = "footer"; app.Groups.Create(newGroup); } //if a contact NOT present if (!app.Contacts.IsContactPresent()) { ContactData newContact = new ContactData("sss", "ddd"); app.Contacts.Create(newContact); } GroupData group = GroupData.GetAll()[0]; List <ContactData> oldList = group.GetContacts(); ContactData contact = ContactData.GetAll().Except(oldList).First(); // ??? find a group where contact is not added // ??? add the contact to this group // ??? else create a new contact and add it to a group //actions app.Contacts.AddContactToGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Add(contact); oldList.Sort(); newList.Sort(); Assert.AreEqual(oldList, newList); }
public void EditContactTest() { app.Contacts.ExistingContactsCheck(); List <ContactData> oldContacts = ContactData.GetAll(); ContactData oldContact = oldContacts[0]; ContactData newData = new ContactData("f-name123", "l-name123"); newData.MiddleName = "m-name123"; app.Contacts.EditContact(newData, oldContact.Id); List <ContactData> newContacts = ContactData.GetAll(); oldContact.FirstName = newData.FirstName; oldContact.LastName = newData.LastName; oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); }
public void DeleteContactTest() { app.Contacts.ExistingContactsCheck(); List <ContactData> oldContacts = ContactData.GetAll(); ContactData toBeRemoved = oldContacts[0]; app.Contacts.DeleteContact(toBeRemoved); List <ContactData> newContacts = ContactData.GetAll(); oldContacts.RemoveAt(0); oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { Assert.AreNotEqual(contact.Id, toBeRemoved.Id); } }
public void CreateNewContactTest(ContactData newcontact) { /*ContactData newcontact = new ContactData("23f-name", "23l-name") * { * MiddleName = "m-name23", * Address = "Str SGhd 12, ap 36", * MobilePhone = "+7 (2374) 2-4-5", * WorkPhone = "9(938) 2-3-4", * Email = "*****@*****.**" * };*/ List <ContactData> oldContacts = app.Contacts.GetContactsList(); app.Contacts.CreateContact(newcontact); List <ContactData> newContacts = ContactData.GetAll(); oldContacts.Add(newcontact); /*System.Console.WriteLine("Old List"); * foreach (var item in oldContacts) * { * System.Console.Write(item.FirstName + " - " + item.LastName); * } * * System.Console.WriteLine(); * System.Console.WriteLine("New List"); * foreach (var item in newContacts) * { * System.Console.Write(item.FirstName + " - " + item.LastName); * }*/ oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); }
public GroupData FindGroupWithContact() { GroupData groupWithContact = new GroupData(); if (!manager.Contacts.DoesContactInGroupExist()) { if (!DoesGroupExist()) { groupWithContact = new GroupData("name"); Create(groupWithContact); } groupWithContact = GroupData.GetAll()[0]; if (!manager.Contacts.DoesContactExist()) { ContactData newContact = new ContactData("name"); manager.Contacts.Create(newContact); } List <ContactData> oldListAdd = groupWithContact.GetContacts(); ContactData contactN = ContactData.GetAll().Except(oldListAdd).First(); manager.Contacts.AddContactToGroup(contactN, groupWithContact); } GroupContactRelation groupWithC = GroupContactRelation.GetAll()[0]; List <GroupData> allGroups = GroupData.GetAll(); foreach (GroupData group in allGroups) { if (group.ID == groupWithC.GroupID) { groupWithContact = group; break; } } return(groupWithContact); }
public void TestAddingContactToGroup() { List <GroupData> listOfGroup = GroupData.GetAll(); if (listOfGroup.Count() == 0) { app.Groups.Create(new GroupData("help")); } List <ContactData> listOfContacts = ContactData.GetAll(); if (listOfContacts.Count() == 0) { app.Contacts.Create(new ContactData("help", "me")); } ContactData contact1 = ContactData.GetAll()[0]; if (GroupData.GetAll().All(x => x.GetContacts().Contains(contact1))) { app.Contacts.Create(new ContactData("111", "222")); } GroupData group = GroupData.GetAll()[0]; List <ContactData> oldList = group.GetContacts(); ContactData contact = ContactData.GetAll().Except(oldList).First(); app.Contacts.AddContactToGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Add(contact); newList.Sort(); oldList.Sort(); Assert.AreEqual(oldList, newList); }
public void ContactRemovalTest() { app.Navigator.GoToContactsPage(); if (!app.Contacts.ExistContactVerification()) { app.Contacts.Create(new ContactData("ccc", "zzz")); } List <ContactData> oldContacts = ContactData.GetAll(); ContactData toBeRemoved = oldContacts[0]; app.Contacts.Remove(toBeRemoved); Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount()); List <ContactData> newContacts = ContactData.GetAll(); oldContacts.RemoveAt(0); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { Assert.AreNotEqual(contact.Id, toBeRemoved.Id); } }
public void TestAddingContactToGroup() { app.Contact.ContactExists(); app.Group.GroupExists(); GroupData group = GroupData.GetAll()[0]; ContactData contact = ContactData.GetAll()[0]; List <ContactData> oldList = group.GetContacts(); List <GroupData> allGroups = contact.GetGroups(); app.Contact.VerifyContactBeforeAdding(allGroups); contact = ContactData.GetAll().Except(group.GetContacts()).First(); app.Contact.AddContactToGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Add(contact); newList.Sort(); oldList.Sort(); Assert.AreEqual(oldList, newList); }
public void TestRemovingContactFromGroup() { //if a group is present if (!app.Groups.IsGroupPresent()) { GroupData newGroup = new GroupData("test1"); newGroup.Header = "header"; newGroup.Footer = "footer"; app.Groups.Create(newGroup); } //if a contact NOT present if (!app.Contacts.IsContactPresent()) { ContactData newContact = new ContactData("sss", "ddd"); app.Contacts.Create(newContact); } GroupData group = GroupData.GetAll()[0]; app.Contacts.AddAllContactsToGroup(group); List <ContactData> oldList = group.GetContacts(); ContactData contact = ContactData.GetAll()[0]; //actions app.Contacts.RemoveContactFromGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Remove(contact); oldList.Sort(); newList.Sort(); Assert.AreEqual(oldList, newList); }
public void ContactModifyTest() { ContactData newData = new ContactData("First name4", "Last Name4", "Address company4"); newData.Middlename = "Middle name2"; newData.Nickname = "Nickname2"; newData.Photo = ""; newData.Title = "Title2"; newData.Company = "Company2"; newData.Address = "Address company2"; newData.Telhome = "Tel home2"; newData.Telmobile = "Tel mobile2"; newData.Telwork = "Tel work2"; newData.Telfax = "Tel fax2"; newData.Email1 = "email12"; newData.Email2 = "email22"; newData.Email3 = "email32"; newData.Homepage = "homepage"; newData.Bday = "2"; newData.Bmonth = "January"; newData.Byear = "1989"; newData.Aday = "2"; newData.Amonth = "January"; newData.Ayear = "2009"; newData.Address2 = "adress sec2"; newData.Phone2 = "home sec2"; newData.Notes = "notes sec2"; int num = 0; if (!app.Contacts.ContactExists(num)) { ContactData contact1 = new ContactData("Default", "Default", "Default"); app.Contacts.Create(contact1); num = 0; } List <ContactData> oldContacts = ContactData.GetAll(); oldContacts.Sort(); ContactData oldData = oldContacts[num]; oldContacts[num].Firstname = newData.Firstname; oldContacts[num].Lastname = newData.Lastname; oldContacts[num].Address = newData.Address; oldContacts.Sort(); app.Contacts.Modify(num, newData); Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount()); List <ContactData> newContacts = ContactData.GetAll(); newContacts.Sort(); //Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { if (contact.Id == oldData.Id) { Assert.AreEqual(newData.Firstname, contact.Firstname); Assert.AreEqual(newData.Lastname, contact.Lastname); Assert.AreEqual(newData.Address, contact.Address); } } }
public int GetContactCount() { return(ContactData.GetAll().Count); //driver.FindElements(By.Name("entry")).Count; }