public void ContactModificationTests()
        {
            if (!app.Contacts.IsFirstContactExist(1))
            {
                ContactData defaultcontact = new ContactData();
                defaultcontact.Firstname = "first1";
                defaultcontact.Lastname  = "last1";

                app.Contacts.CreateContact(defaultcontact);
            }

            ContactData changedcontact = new ContactData();

            changedcontact.Firstname = "4444";
            changedcontact.Lastname  = "55555";

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

            app.Contacts.ModifyContact(toBeModified, changedcontact);

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

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

            oldContacts[0] = changedcontact;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
Beispiel #2
0
        public void TestDeleteContactFromGroup()
        {
            app.Contacts.IsContactExist();
            app.Groups.IsGroupExist();
            GroupData   group = GroupData.GetAllFromDB()[9];
            ContactData contact;

            if (group == null)
            {
                app.Groups.IsGroupExist();
                group = GroupData.GetAllFromDB()[9];
            }

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

            if (group.GetContact().Count == 0)
            {
                contact = ContactData.GetAllFromDB()[0];
                app.Contacts.AddContactToGroup(contact, group);
            }
            else
            {
                contact = oldList[0];
            }
            contact = ContactData.GetAllFromDB().First();
            app.Contacts.IsAddedInGroup(contact, oldList, group);
            //действия
            app.Contacts.DeleteContactFromGroup(contact, group);
            List <ContactData> newList = group.GetContact();

            oldList.Remove(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }
        public void DeleteContactTest()
        {
            int index = 1;

            if (!app.Contacts.IsFirstContactExist(index))
            {
                ContactData defaultcontact = new ContactData();
                defaultcontact.Firstname = "first1";
                defaultcontact.Lastname  = "last1";

                app.Contacts.CreateContact(defaultcontact);
            }
            List <ContactData> oldContacts = ContactData.GetAllFromDB();
            ContactData        toBeRemoved = oldContacts[0];

            app.Contacts.DeleteContact(toBeRemoved);

            Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount());
            List <ContactData> newContacts = ContactData.GetAllFromDB();

            oldContacts.RemoveAt(index - 1);
            //   oldContacts.Sort();
            //  newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
        public void TestAddingContactToGroup()
        {
            if (!ContactData.GetAllFromDB().Any())
            {
                ContactData defaultcontact = new ContactData();
                defaultcontact.Firstname = "first1";
                defaultcontact.Lastname  = "last1";

                app.Contacts.CreateContact(defaultcontact);
            }

            if (!GroupData.GetAllFromDB().Any())
            {
                GroupData defaultData = new GroupData("1111");
                app.Groups.Create(defaultData);
            }


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

            app.Contacts.AddContactToGroup(contact, group);
            List <ContactData> newList = group.GetContacts();

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

            Assert.AreEqual(oldList, newList);
        }
Beispiel #5
0
        public void AddingContactToGroupTest()
        {
            GroupData          group   = GroupData.GetAllFromDB()[0];
            List <ContactData> oldList = group.GetContactInGroup();
            ContactData        contact; // = ContactData.GetAllFromDB().Except(oldList).First();

            contact = ContactData.GetAllFromDB().Except(oldList).First();

            /*try
             * {
             *  contact = ContactData.GetAllFromDB().Except(oldList).First();
             * }
             * catch (System.InvalidOperationException)
             * {
             *  System.Console.Out.WriteLine("все контакты уже состоят в выбранной группе");
             *  throw;
             * }*/

            app.Contacts.AddContactToGroup(contact, group);

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

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

            Assert.AreEqual(oldList, newList);
        }
 public void CompareContactsUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <ContactData> fromUI = app.Contacts.GetContactList();
         List <ContactData> fromDB = ContactData.GetAllFromDB();
         fromUI.Sort();
         fromDB.Sort();
         Assert.AreEqual(fromUI, fromDB);
     }
 }
 public void ComapareContacUI_DB()
 {
     if (PERFOM_LONG_UI_CHECKS)
     {
         List <ContactData> contactsUI = app.Contacts.GetContactList();
         List <ContactData> contactsDB = ContactData.GetAllFromDB();
         contactsUI.Sort();
         contactsDB.Sort();
         Assert.AreEqual(contactsUI, contactsDB);
     }
 }
 public void TestContactCreation(ContactData contact)
 {
     List<ContactData> oldContacts = ContactData.GetAllFromDB();
     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);
 }
Beispiel #9
0
        public void CheckIfConactIsInAllGroups()
        {
            GroupData          group       = GroupData.GetAllFromDB()[0];
            List <ContactData> areInGroup  = group.GetContactInGroup();
            List <ContactData> allExisting = ContactData.GetAllFromDB();

            if (areInGroup.Count() == allExisting.Count())
            {
                app.Contacts.Create(new ContactData()
                {
                    Firstname = "I am",
                    Lastname  = "The Chosen One"
                });
            }
        }
        public void TestContactModification()
        {
            app.Contacts.IsContactExist();
            ContactData        newData     = new ContactData("SSS", "ppp");
            List <ContactData> oldContacts = ContactData.GetAllFromDB();

            app.Contacts.Modification(oldContacts[0], newData);
            Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactsCount());
            List <ContactData> newContacts = ContactData.GetAllFromDB();

            oldContacts[0].LastName  = newData.LastName;
            oldContacts[0].FirstName = newData.FirstName;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
Beispiel #11
0
        public void ContactRemovalTest()
        {
            app.Contacts.IsContactExist();
            List <ContactData> oldContacts = ContactData.GetAllFromDB();
            ContactData        toBeRemoved = oldContacts[0];

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

            Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactsCount());
            oldContacts.RemoveAt(0);
            //oldContacts.Sort();
            //newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
            foreach (ContactData contact in newContacts)
            {
                Assert.AreNotEqual(toBeRemoved.Id, contact.Id);
            }
        }
Beispiel #12
0
        public void ContactCreationTest(ContactData newContact)
        {
            /*ContactData newContact = new ContactData();
             * newContact.Firstname = "Имя";
             * newContact.Lastname = "Фамилия";*/

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

            app.Navigator.AddNewContact();
            app.Contacts.Create(newContact);
            Assert.AreEqual(oldContacts.Count + 1, app.Contacts.GetContactCount());
            List <ContactData> newContacts = ContactData.GetAllFromDB();

            oldContacts.Add(newContact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
            //app.Auth.Logout();
        }
        public void CheckIfThereIsAContactInAGroup()
        {
            GroupData          group      = GroupData.GetAllFromDB()[0];
            List <ContactData> areInGroup = group.GetContactInGroup();

            if (areInGroup.Count() == 0)
            {
                List <ContactData> areNotInGroup = ContactData.GetAllFromDB().Except(areInGroup).ToList();
                if (areNotInGroup.Count() == 0)
                {
                    app.Contacts.Create(new ContactData()
                    {
                        Firstname = "I will be",
                        Lastname  = "In this group!"
                    });
                }
                ContactData contact = ContactData.GetAllFromDB().Except(areInGroup).First();
                app.Contacts.AddContactToGroup(contact, group);
            }
        }
        public void  CreatesContact(ContactData newcontact)
        {
            // ContactData newcontact = new ContactData();
            // newcontact.Firstname = "first";
            // newcontact.Lastname = "last";

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

            app.Contacts.CreateContact(newcontact);
            // app.Auth.LogOut();


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

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

            oldContacts.Add(newcontact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
Beispiel #15
0
        public void TestAddContactToGroup()
        {
            app.Contacts.IsContactExist();
            app.Groups.IsGroupExist();
            GroupData          group   = GroupData.GetAllFromDB()[0];
            List <ContactData> oldList = group.GetContact();
            ContactData        contact;

            if (GroupData.GetAllFromDB().Count == oldList.Count)
            {
                contact = new ContactData("SSS", "QQQ"); //создем новый контакт, если в группу входят все контакты
                app.Contacts.Create(contact);
            }
            contact = ContactData.GetAllFromDB().Except(oldList).First();
            //действия
            app.Contacts.AddContactToGroup(contact, group);

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

            oldList.Add(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }