public void ContactRemovalTest()
        {
            List <ContactData> oldContacts = ContactData.GetAll();

            ContactData toBeRemoved = oldContacts[0];

            app.Contact.Remove(toBeRemoved);

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

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(0);

            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                //Console.Out.Write("ИД текущего контакта <"+contact.Id+"> <> ИД удалённого контакта <"+toBeRemoved.Id+">"+'\n');
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }
        public void ContactModificationTest()
        {
            app.Contacts.ContactExists();

            ContactData nawData = new ContactData("Ivanov", "Pet0000r");

            List <ContactData> oldContacts = ContactData.GetAll();

            ContactData toBeModifiCon = oldContacts[0];

            app.Contacts.ModifyContact(toBeModifiCon, nawData);

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

            List <ContactData> newContacts = ContactData.GetAll();

            toBeModifiCon = nawData;
            oldContacts.Sort();
            newContacts.Sort();

            Assert.AreEqual(oldContacts, newContacts);
        }
Пример #3
0
        public void TestRemovingContactFromGroup()
        {
            app.Groups.EnsureGroupsExists();

            GroupData group = GroupData.GetAll()[0];

            app.Contacts.EnsureContactsInGroupExists(group);

            List <ContactData> oldList = group.GetContacts();

            ContactData contact = ContactData.GetAll().Intersect(oldList).First();

            app.Contacts.RemoveContactFromGroup(contact, group);

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

            oldList.Remove(contact);
            newList.Sort();
            oldList.Sort();

            Assert.AreEqual(oldList, newList);
        }
Пример #4
0
        public void ContactRemovalTest()
        {
            int i = 0;

            app.Contacts.CreateIfNotPresent(i + 1);
            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        tbr         = oldContacts[i];

            app.Contacts.Remove(tbr);

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

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(i);
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData c in newContacts)
            {
                Assert.AreNotEqual(c.Id, tbr.Id);
            }
        }
Пример #5
0
        public void ContactModificationTest()
        {
            if (app.Contacts.GetContactCount() == 0)
            {
                app.Contacts.Create(new ContactData("fff", "gggg"));
            }

            ContactData newData = new ContactData("fef", "urur");

            List <ContactData> oldContacts  = ContactData.GetAll();
            ContactData        toBeModified = oldContacts[0];

            app.Contacts.Modify(toBeModified, newData);

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts[0].FirstName = newData.FirstName;
            oldContacts[0].LastName  = newData.LastName;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
        public void CreateIfNotContacts()
        {
            if (ContactData.GetAll() == null)
            {
                Create(new ContactData(
                           TestBase.GenerateRandomString(20),
                           TestBase.GenerateRandomString(50),
                           TestBase.GenerateRandomString(20)
                           )
                {
                    Address     = TestBase.GenerateRandomString(300),
                    HomePhone   = TestBase.GenerateRandomPhoneNumeric(),
                    MobilePhone = TestBase.GenerateRandomPhoneNumeric(),
                    WorkPhone   = TestBase.GenerateRandomPhoneNumeric(),


                    Email1 = TestBase.GenerateRandomEmail(20, 5),
                    Email2 = TestBase.GenerateRandomEmail(20, 5),
                    Email3 = TestBase.GenerateRandomEmail(20, 5),
                });
            }
        }
Пример #7
0
        public void ContactEditionTest()
        {
            //Номер контакта для редактирования
            int index = 1;

            if (app.Contacts.IsContactListEmpty() || !app.Contacts.IsIndex(index, 1))
            {
                index = app.Contacts.CreateSomeContact();
            }

            ContactData contactModified = new ContactData("Liza1", "Jhons1");

            //List<ContactData> oldContacts = app.Contacts.GetContactList();
            List <ContactData> oldContacts  = ContactData.GetAll();
            ContactData        toBeModified = oldContacts[index];

            app.Contacts.Edit(toBeModified, contactModified);

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

            //List<ContactData> newContacts = app.Contacts.GetContactList();
            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts[index].FirstName = contactModified.FirstName;
            oldContacts[index].LastName  = contactModified.LastName;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                if (contact.Id == toBeModified.Id)
                {
                    Assert.AreEqual(contactModified.FirstName, contact.FirstName);
                    Assert.AreEqual(contactModified.LastName, contact.LastName);
                }
            }
        }
Пример #8
0
        public void ContactModificationTest()
        {
            var         a       = new Random().Next(1, 13000);
            ContactData newData = (new ContactData("Ivanov" + a, "Ivan" + a));

            newData.Mobilephone = null;
            newData.Homephone   = null;
            newData.Workphone   = null;
            newData.Email       = null;
            newData.Email2      = null;
            newData.Email3      = null;

            app.Contacts.GreateContactIfNotExist();

            List <ContactData> oldContacts  = ContactData.GetAll();
            ContactData        toBeModified = oldContacts[0];

            app.Contacts.Modify(toBeModified, newData);
            app.Navigator.GoToContactsPage();

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

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts[0].Lastname  = newData.Lastname;
            oldContacts[0].Firstname = newData.Firstname;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                if (contact.Id == toBeModified.Id)
                {
                    Assert.AreEqual(newData.Firstname, toBeModified.Firstname);
                }
            }
        }
Пример #9
0
        public void TestRemoveContactFromGroup()
        {
            // Проверяем, есть ли группы, если нет - добавляем

            if (GroupData.GetAll().Count == 0)
            {
                app.Groups.Create(new GroupData("aaa", "sss", "ddd"));
            }
            List <GroupData> groups = GroupData.GetAll();

            for (int i = 0; i < groups.Count(); i++)
            {
                GroupData group = groups[i];
                // Проверяем, есть ли контакты, если нет - добавляем

                if (ContactData.GetAll().Count == 0)

                {
                    app.Contacts.Create(new ContactData("aaa", "sss"));
                    ContactData createdContact = ContactData.GetAll().First();
                    app.Contacts.AddContactToGroup(createdContact, group);
                }
                // Проверяем, есть ли контакты в группе, если нет - добавляем

                if (group.GetContacts().Count() == 0)
                {
                    app.Contacts.AddContactToGroup(ContactData.GetAll()[0], group);
                }
                List <ContactData> oldList         = group.GetContacts();
                ContactData        contactToRemove = oldList[0];
                app.Contacts.RemoveContactFromGroup(contactToRemove, group);
                List <ContactData> newList = group.GetContacts();
                oldList.Remove(contactToRemove);
                newList.Sort();
                oldList.Sort();
                Assert.AreEqual(oldList, newList);
            }
        }
Пример #10
0
        public void TestAddingAllContactsToGroup()
        {
            List <GroupData> groups = GroupData.GetAll().ToList();

            for (int i = 0; i < groups.LongCount(); ++i)
            {
                bool               addition = true;
                GroupData          group    = groups[i];
                List <ContactData> oldList  = group.GetContacts();
                List <ContactData> all      = ContactData.GetAll().ToList();

                foreach (ContactData contact in all)
                {
                    addition = true;
                    foreach (ContactData existContact in oldList)
                    {
                        if (contact.Id == existContact.Id)
                        {
                            addition = false; break;
                        }
                    }

                    if (addition)
                    {
                        //actions
                        app.Contacts.AddContactsToGroup(contact, group);
                        //compare

                        List <ContactData> newList = group.GetContacts();
                        oldList.Add(contact);
                        oldList.Sort();
                        newList.Sort();

                        Assert.AreEqual(oldList, newList);
                    }
                }
            }
        }
        public void RemovingContactFromGroupTest()
        {
            var groupData = new GroupData();
            var groups    = groupData.GetGroupWithContacts();

            if (groups.Count == 0 || groupData == null)
            {
                if (!app.Groups.IsGroupPresent())
                {
                    GroupData defData = new GroupData("def1");
                    app.Groups.Create(defData);
                }
                groupData = GroupData.GetAll().FirstOrDefault();

                ContactData contact = ContactData.GetAll().FirstOrDefault();
                if (contact == null)
                {
                    app.Contacts.Create((new ContactData()
                    {
                        Firstname = "testName1"
                    }));
                }
                app.Contacts.AddContactToGroup((ContactData.GetAll().FirstOrDefault()), groupData);
            }


            List <ContactData> oldContactList = groupData.GetContacts();

            app.Contacts.RemoveContactFromGroup(groupData, oldContactList[0]);
            List <ContactData> newContactList = groupData.GetContacts();

            oldContactList.Remove(oldContactList[0]);

            oldContactList.Sort();
            newContactList.Sort();

            Assert.AreEqual(oldContactList, newContactList);
        }
Пример #12
0
        public void TestAddingContactToGroup()
        {
            var manager = app.Groups.GetManager();

            manager.Navigator.GoToGroupsPage();
            app.Groups.EnsureThereIsAtLeastOneGroup();
            manager.Navigator.GoToHomePage();
            app.Contacts.EnsureThereIsAtLeastOneContact();

            GroupData          group   = GroupData.GetAll()[0];
            List <ContactData> oldList = group.GetContacts();
            ContactData        contact = ContactData.GetAll().Except(oldList).First();

            bool canAddToGroup = app.Contacts.EnsureThereContactAddTheGroup(contact, group);


            if (canAddToGroup)
            {
                app.Contacts.AddContactToGroup(contact, group);
            }
            else
            {
                contact.Firstname = "a1aa";
                contact.Lastname  = "bb1b";
                app.Contacts.Create(contact);

                app.Contacts.AddContactToGroup(contact, group);
            }

            System.Threading.Thread.Sleep(100);
            List <ContactData> newList = group.GetContacts();

            oldList.Add(contact);
            newList.Sort();
            oldList.Sort();

            Assert.AreEqual(oldList, newList);
        }
        public void ContactAddingTest(ContactData contact)
        {
            //Генерируем данные для нового контакта
            //ContactData contact = app.Contacts.GenerateContactData();

            //Считываем текущий список контактов
            List <ContactData> oldContacts = ContactData.GetAll();

            app.Contacts.Create(contact);

            //Считываем новый список контактов
            List <ContactData> newContacts = app.Contacts.GetContactList();

            Assert.AreEqual(oldContacts.Count + 1, newContacts.Count);

            //Добавляем данные нового контакта в старый список
            oldContacts.Add(contact);

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

            Assert.AreEqual(oldContacts, newContacts);
        }
        public void ContactModificationTest()
        {
            ContactData newData = new ContactData("petr", "petrov");

            app.Contacts.ContactIsPresent();

            List <ContactData> oldContacts  = ContactData.GetAll();
            ContactData        toBeModifyed = oldContacts[0];

            app.Contacts.ModifyById(toBeModifyed, newData);

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts[0].Lastname = newData.Lastname;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                Assert.AreEqual(contact.Id, toBeModifyed.Id);
            }
        }
Пример #15
0
        public void ContactRemovalTest()
        {
            if (!app.Contact.ContactExist())
            {
                app.Contact.AddContact(defaultData);
            }

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        toBeRemoved = oldContacts[0];

            app.Contact.Remove(toBeRemoved);

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(0);
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                //проверка на то, что ид удаленного элемента не совпадает со всеми остальными
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }
Пример #16
0
        public void ContactRemovalTest()
        {
            int NumberOfContact = 0;

            applicationManager.PubContactHelper.ChackOrCreateContact(NumberOfContact);

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        ToBeRemove  = oldContacts[NumberOfContact];

            applicationManager.PubContactHelper.Remove(ToBeRemove);

            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, ToBeRemove.Id);
            }
        }
        public void ContactRemovalTest()
        {
            app.Contacts.ContactIsPresent();

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        toBeRemoved = oldContacts[0];

            app.Contacts.RemoveById(toBeRemoved);

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

            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);
            }
        }
Пример #18
0
        public void ContactRemovalTest()
        {
            if (app.Contacts.IsEmptyContactList())
            {
                app.Contacts.Create(new ContactData("Additional", "Contact"));
            }
            List <ContactData> oldContacts = ContactData.GetAll();

            ContactData toBeRemoved = oldContacts[0];

            app.Contacts.Remove(toBeRemoved);
            app.Navigator.GoToContactPage();

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(0);

            Assert.AreEqual(oldContacts, newContacts);
            foreach (ContactData contact in newContacts)
            {
                Assert.AreNotEqual(toBeRemoved.Id, contact.Id);
            }
        }
        public void ContactRemovalTest()
        {
            int index = 0;

            if (app.Contacts.IsContactListEmpty())
            {
                app.Contacts.Create(new ContactData("", ""));
            }

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        toBeRemoved = oldContacts[index];

            app.Contacts.Remove(toBeRemoved.Id);
            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(index);

            Assert.AreEqual(oldContacts, newContacts);
            foreach (ContactData contact in newContacts)
            {
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }
Пример #20
0
        public void ContactRemovalTest()
        {
            List <ContactData> oldContacts = ContactData.GetAll();
            var removeContactId            = oldContacts[0].Id;

            app.Contacts.Remove(removeContactId);

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

            List <ContactData> newContacts = ContactData.GetAll();

            newContacts.Sort();

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

            Assert.AreEqual(oldContacts, newContacts);

            foreach (var group in newContacts)
            {
                Assert.AreNotEqual(removeContactId, group.Id);
            }
        }
Пример #21
0
        public void DeleteContactByHomePage()
        {
            app.Contact.CheckForAvailabilityСontact();

            List <ContactData> oldContact         = ContactData.GetAll();
            ContactData        toBeRemovedContact = oldContact[0];

            app.Contact.SelectContactOnHomePage(toBeRemovedContact.Id);
            app.Contact.DeleteContOnHome();
            app.Navigator.GoToHomePage();

            List <ContactData> newContact = ContactData.GetAll();

            oldContact.RemoveAt(0);
            oldContact.Sort();
            newContact.Sort();

            Assert.AreEqual(oldContact, newContact);
            foreach (ContactData contact in newContact)
            {
                Assert.AreNotEqual(contact.Id, toBeRemovedContact.Id);
            }
        }
Пример #22
0
        public void ContactRemovalDBTest()
        {
            //prepare
            ContactData createContact = new ContactData("Ivan3", "Ivanov");

            app.Contact.IsElementContactAndCreate(createContact);

            //action
            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        toBeReoved  = oldContacts[0];

            app.Contact.Remove(toBeReoved);

            app.Navigator.OpenHomePage();
            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.RemoveAt(0);

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

            Assert.AreEqual(oldContacts, newContacts);
        }
Пример #23
0
        public void ContactModificationTest()
        {
            //prepare
            ContactData olddata = new ContactData("jfswerf", "fjlkhg");


            ContactData newdata = new ContactData("fdhgfdh", "fgh");


            //action
            app.Contacts.CreateIfNotExist(olddata.Firstname, olddata.Lastname, olddata);
            List <ContactData> oldcontacts = ContactData.GetAll();
            int         i          = app.Contacts.FindIndexByName(olddata.Lastname + " " + olddata.Firstname);
            ContactData oldcontact = oldcontacts[i];

            app.Contacts.Modify(oldcontact, newdata);

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

            List <ContactData> contacts = ContactData.GetAll();

            oldcontacts[i].Firstname = newdata.Firstname;
            oldcontacts[i].Lastname  = newdata.Lastname;

            oldcontacts.Sort();
            contacts.Sort();

            Assert.AreEqual(oldcontacts, contacts);

            foreach (ContactData contact in contacts)
            {
                if (contact.Id == oldcontact.Id)
                {
                    Assert.AreEqual(newdata.Lastname + newdata.Firstname, contact.Lastname + contact.Firstname);
                }
            }
        }
Пример #24
0
        public void AddingContactToGroupTest()
        {
            List <GroupData>   groups   = GroupData.GetAll();
            List <ContactData> contacts = ContactData.GetAll();

            groups   = appManager.Groups.IsGroupPresents(groups);
            contacts = appManager.Contacts.IsContactPresents(contacts);

            GroupData          group   = groups[0];
            ContactData        contact = contacts[0];
            List <ContactData> oldList = group.GetContacts();

            if (appManager.Groups.SelectGroupWithoutContact(groups, contacts) != null)
            {
                group = appManager.Groups.SelectGroupWithoutContact(groups, contacts);
            }
            else
            {
                appManager.Contacts.Create(new ContactData()
                {
                    FirstName = "Name", LastName = "Surname"
                });
                contacts = ContactData.GetAll();
            }
            oldList = group.GetContacts();
            contact = appManager.Contacts.SelectContact(oldList, contacts);

            appManager.Contacts.AddContactToGroup(contact, group);


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

            oldList.Add(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }
        public void ContactRemovalTest()
        {
            // выяснить есть ли запись если нету то создать
            app.Contacts.Analis();


            // List<ContactData> oldcont = app.Contacts.GetContactList();
            List <ContactData> oldcont     = ContactData.GetAll();
            ContactData        ToBeRemoved = oldcont[0];

            //System.Console.Out.WriteLine("kolOldcont=" + oldcont.Count);

            //удалить запись
            app.Contacts.Removal(ToBeRemoved);


            System.Threading.Thread.Sleep(1000); //Не проходила проверка поколичеству я предположила что считать начинает раньше чем успевает удалиться запись, поэтому сделала паузу в одну секунду
            //несколько тупо, но я не сообразила появления какого элемента надо ожидать

            // System.Console.Out.WriteLine("kol2="+ app.Contacts.GetContactCount());

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

            // List<ContactData> newcont = app.Contacts.GetContactList();
            List <ContactData> newcont = ContactData.GetAll();

            ContactData ForRemoving = oldcont[0];

            oldcont.RemoveAt(0);

            Assert.AreEqual(oldcont, newcont);

            foreach (ContactData contact in newcont)
            {
                Assert.AreNotEqual(contact.Id, ForRemoving.Id);
            }
        }
        public void RemovingContactFromGroupTest()
        {
            GroupData group = GroupData.GetAll().Find((GroupData groupData) =>
            {
                return(groupData.GetContacts().Count != 0);
            });

            if (group == null)
            {
                if (GroupData.GetAll().Count == 0)
                {
                    app.Groups.Create(GroupDataFromJsonFile());
                }

                group = GroupData.GetAll().First();

                if (ContactData.GetAll().Count == 0)
                {
                    app.Contacts.Create(ContactDataFromJsonFile());
                }

                app.Contacts.AddContactToGroup(ContactData.GetAll().First(), group);
            }

            List <ContactData> oldList = group.GetContacts();
            ContactData        contact = oldList.First();

            app.Contacts.RemoveContactFromGroup(contact, group);

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

            oldList.Remove(contact);
            newList.Sort();
            oldList.Sort();

            Assert.AreEqual(oldList, newList);
        }
        //удалить один контакт, вызвано из списка контакта
        public void ContactRemovalTest_RemoveOne()
        {
            List <int> Index = new List <int>();

            Index.Add(0); //отсчет от 0; для упрощения проверки теста удалению будет подвергаться первый контакт

            //List<ContactData> oldContacts = app.Contacts.GetContactList();
            List <ContactData> oldContacts = ContactData.GetAll();

            if (oldContacts.Count == 0)
            {
                app.Contacts.Create(new ContactData("firstName", "lastName"));
                //oldContacts.Add(new ContactData("firstName", "lastName"));
                oldContacts = ContactData.GetAll(); //app.Contacts.GetContactList(); //чтобы также узнать идентификатор созданного контакта
            }

            //app.Contacts.RemoveSelectedContactsFromList(Index);
            List <ContactData> toBeRemoved = new List <ContactData>();

            toBeRemoved.Add(oldContacts[Index[0]]);
            app.Contacts.RemoveSelectedContactsFromList(toBeRemoved);
            oldContacts.RemoveAt(Index[0]);

            //List<ContactData> newContacts = app.Contacts.GetContactList();
            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                Assert.AreNotEqual(contact.Id, toBeRemoved[0].Id);
            }

            //app.Auth.Logout();
        }
Пример #28
0
        public void ContactModificationTest()
        {
            int         index      = 0;
            ContactData newContact = new ContactData("NewName", "NewLastName");

            newContact.Nickname = "NewNickName";
            newContact.Group    = "ZZZ";

            if (app.Contacts.IsContactListEmpty())
            {
                app.Contacts.Create(new ContactData("", ""));
            }

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        oldDate     = oldContacts[index];

            app.Contacts.Modify(oldDate.Id, newContact);

            List <ContactData> newContacts = ContactData.GetAll();

            oldContacts[index].Name     = newContact.Name;
            oldContacts[index].LastName = newContact.LastName;

            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                if (contact.Id == oldDate.Id)
                {
                    Assert.AreEqual(newContact.Name, contact.Name);
                    Assert.AreEqual(newContact.LastName, contact.LastName);
                }
            }
        }
        public void ContactModificationTest()
        {
            ContactData newData = new ContactData("ztest1", "ztest2");
            int         num     = 0;

            //интеллектуальность теста
            if (!app.Contacts.FindContact(num))
            {
                ContactData data = new ContactData("contactModif", "contactModif");
                app.Contacts.Create(data);
            }

            List <ContactData> oldContacts = ContactData.GetAll(); //Сравнение данных из БД и интерфейса
            ContactData        oldData     = oldContacts[num];

            app.Contacts.Modify(oldData, newData);

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

            List <ContactData> newContacts = ContactData.GetAll(); //Сравнение данных из БД и интерфейса

            oldData.Lastname  = newData.Lastname;
            oldData.Firstname = newData.Firstname;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactData contact in newContacts)
            {
                if (contact.Id == oldData.Id)
                {
                    Assert.AreEqual(newData.Lastname, contact.Lastname);
                    Assert.AreEqual(newData.Firstname, contact.Firstname);
                }
            }
        }
        public void ContactRemovalTest()
        {
            if (!applicationManager.Contacts.IsElementPresent(By.Name("selected[]")))
            {
                applicationManager.Contacts.Create(new ContactData("Test", "Test"));
            }

            List <ContactData> oldContacts = ContactData.GetAll();
            ContactData        toBeRemoved = oldContacts[0];

            applicationManager.Contacts.Remove(toBeRemoved);

            Assert.AreEqual(oldContacts.Count - 1, applicationManager.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);
            }
        }