public void Test_CreateContactValidData() { CreateContactPage createContactPage = new CreateContactPage(); createContactPage.Open(); Assert.Multiple(() => { Assert.IsTrue(createContactPage.IsOpen()); Assert.AreEqual("Create Contact", createContactPage.PageTitle.Text); }); ContactData newContact = new ContactData() { FirstName = Helpers.GetRandomString(10), LastName = Helpers.GetRandomString(10), Email = "*****@*****.**", Phone = "+1234567890", Comments = "Random comment: " + Helpers.GetRandomString(20) }; createContactPage.CreateNewContact(newContact); ContactsPage contactsPage = new ContactsPage(); List <ContactData> listContacts = contactsPage.GetAllContactsInTable(); Assert.That(listContacts.Any(cont => cont.FirstName == newContact.FirstName)); }
public void Test_CreateContactInvalidData(string fName, string lname, string email, string phone, string comment, string expected) { CreateContactPage createContactPage = new CreateContactPage(); createContactPage.Open(); Assert.Multiple(() => { Assert.IsTrue(createContactPage.IsOpen()); Assert.AreEqual("Create Contact", createContactPage.PageTitle.Text); }); ContactData newContact = new ContactData() { FirstName = fName, LastName = lname, Email = email, Phone = phone, Comments = comment }; createContactPage.CreateNewContact(newContact); Assert.AreEqual(expected, createContactPage.DivErr.Text); }