public void AddingContactToGroupTest()
        {
            ContactData tempData  = new ContactData("q", "q");
            GroupData   tempGroup = new GroupData("z", "z", "z");

            app.ContactH.CheckCountContacts(tempData);
            app.GroupH.CheckCountGroups(tempGroup);

            //-------------------
            GroupData group = new GroupData();

            ContactData             contact       = ContactData.GetAll().First();
            List <GroupData>        contactGroups = contact.GetGroups();
            IEnumerable <GroupData> freeGroups    = GroupData.GetAll().Except(contactGroups);

            if (freeGroups.Count() == 0)
            {
                app.ContactH.Create(tempData);
                contact    = ContactData.GetAll().Last();
                freeGroups = GroupData.GetAll();
            }
            group = freeGroups.First();

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

            //-------------------

            app.ContactH.AddContactToGroup(contact, group);


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

            oldCont.Add(contact);
            oldCont.Sort();
            newCont.Sort();

            Assert.AreEqual(oldCont, newCont);
        }
        public void DeleteContactFromGroupTest()
        {
            ContactData tempData  = new ContactData("q", "q");
            GroupData   tempGroup = new GroupData("z", "z", "z");

            app.ContactH.CheckCountContacts(tempData);
            app.GroupH.CheckCountGroups(tempGroup);

            //-----------------
            GroupData group = new GroupData();

            ContactData      contact       = ContactData.GetAll().First();
            List <GroupData> contactGroups = contact.GetGroups();

            if (contactGroups.Count() == 0)
            {
                group = GroupData.GetAll().First();
                app.ContactH.AddContactToGroup(contact, group);
            }
            else
            {
                group = contactGroups.First();
            }

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

            //-----------------

            app.ContactH.RemoveContactFromGroup(contact, group);

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

            oldCont.Remove(contact);
            oldCont.Sort();
            newCont.Sort();

            Assert.AreEqual(oldCont, newCont);
        }