public void AddingContactToGroup()
        {
            if (GroupData.GetGroupsListFromDb().Count == 0)
            {
                applicationManager.GroupHelper.Create(new GroupData()
                {
                    Name = "emergency group"
                });
            }

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

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

            if (ContactData.GetContactsListFromDb().Except(initialContacts).FirstOrDefault() == null)
            {
                applicationManager.ContactsHelper.AddContact(new ContactData
                {
                    FirstName = "emergency",
                    LastName  = "contact"
                });
            }

            ContactData contact = ContactData.GetContactsListFromDb().Except(initialContacts).First();

            applicationManager.ContactsHelper.AddContactToGroup(contact, group);

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

            initialContacts.Add(contact);
            initialContacts.Sort();
            modifiedContacts.Sort();

            Assert.AreEqual(initialContacts, modifiedContacts);
        }
예제 #2
0
        public void CompareContactsUI_DB()
        {
            if (PERFORM_LONG_UI_CHECKS)
            {
                List <ContactData> fromUI = applicationManager.ContactsHelper.GetContactsList();
                List <ContactData> fromDb = ContactData.GetContactsListFromDb();

                fromUI.Sort();
                fromDb.Sort();

                Assert.AreEqual(fromUI, fromDb);
            }
        }
        public void ContactCreationTest(ContactData contact)
        {
            List <ContactData> initialContactList = ContactData.GetContactsListFromDb();

            applicationManager.ContactsHelper.AddContact(contact);

            List <ContactData> modifiedContactList = ContactData.GetContactsListFromDb();

            initialContactList.Add(contact);
            initialContactList.Sort();
            modifiedContactList.Sort();

            Assert.AreEqual(initialContactList, modifiedContactList);
        }
        public void ContactModificationTest()
        {
            applicationManager.ContactsHelper.EnsureContactExists();

            List <ContactData> initialContactList = ContactData.GetContactsListFromDb();
            ContactData        toBeModified       = initialContactList[0];

            applicationManager.ContactsHelper.ModifyContact(toBeModified, new ContactData("Elake", "Laiset"));

            List <ContactData> modifiedContactList = ContactData.GetContactsListFromDb();

            initialContactList[0] = new ContactData("Elake", "Laiset");

            applicationManager.NavigationHelper.GoToHomePage();

            initialContactList.Sort();
            modifiedContactList.Sort();
            Assert.AreEqual(initialContactList, modifiedContactList);
        }
        public void ContactRemovalTest()
        {
            applicationManager.ContactsHelper.EnsureContactExists();

            List <ContactData> initialContactList = ContactData.GetContactsListFromDb();
            ContactData        toBeRemoved        = initialContactList[0];

            applicationManager.ContactsHelper.RemoveContact(toBeRemoved);

            List <ContactData> modifiedContactList = ContactData.GetContactsListFromDb();

            initialContactList.Remove(toBeRemoved);

            applicationManager.NavigationHelper.GoToHomePage();

            initialContactList.Sort();
            modifiedContactList.Sort();

            Assert.AreEqual(initialContactList, modifiedContactList);
        }
        public void RemoveContactFromGroupTest()
        {
            if (GroupData.GetGroupsListFromDb().Count == 0)
            {
                applicationManager.GroupHelper.Create(new GroupData()
                {
                    Name = "emergency group"
                });
            }

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

            if (group.GetContacts().Count == 0)
            {
                if (ContactData.GetContactsListFromDb().Count == 0)
                {
                    applicationManager.ContactsHelper.AddContact(new ContactData
                    {
                        FirstName = "emergency",
                        LastName  = "contact"
                    });
                }

                applicationManager.ContactsHelper.AddContactToGroup(ContactData.GetContactsListFromDb()[0], group);
            }

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

            ContactData toBeRemoved = initialContactsList[0];

            applicationManager.ContactsHelper.RemoveContactFromGroup(toBeRemoved, group);

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

            initialContactsList.Remove(toBeRemoved);
            initialContactsList.Sort();
            modifiedContactsList.Sort();

            Assert.AreEqual(initialContactsList, modifiedContactsList);
        }