public void ContactRemovalTestFromEditForm(EntryDate newEntry)
        {
            //EntryDate newEntry = new EntryDate("Ivan123", "Ivanov123", "Moscow, Pyshkina 3, room 123");
            //newEntry.MiddleName = "Ivanovich123";
            //newEntry.MobilePhone = "777777";
            //newEntry.E_mail = "*****@*****.**";

            AppManager.Contact.CheckPresenceContact(newEntry);
            List <EntryDate> oldContactList = EntryDate.GetAll();

            //Созраняем контакт,который будем удалять
            EntryDate removalContact = oldContactList[0];

            AppManager.Contact.Delete(removalContact);

            //Быстрая проверка
            Assert.AreEqual(oldContactList.Count - 1, AppManager.Contact.GetContactCount());

            List <EntryDate> newContactList = EntryDate.GetAll();

            oldContactList.RemoveAt(0);

            AppManager.Contact.CheckContactResultByObj(oldContactList, newContactList);

            //Проверяем, что в новом списке контактов, нету с идентификитором удаленного.
            foreach (EntryDate e in newContactList)
            {
                Assert.AreNotEqual(e.Id, removalContact.Id);
            }
        }
Esempio n. 2
0
        public void ContactCreationTest(EntryDate entry)
        {
            List <EntryDate> oldContactsList = EntryDate.GetAll();

            AppManager.Contact.Create(entry);
            Assert.AreEqual(oldContactsList.Count + 1, AppManager.Contact.GetContactCount());
            oldContactsList.Add(entry);
            List <EntryDate> NewContactsList = EntryDate.GetAll();

            AppManager.Contact.CheckContactResultByObj(oldContactsList, NewContactsList);
        }
Esempio n. 3
0
        public void ContactAddGroup()
        {
            GroupData group = GroupData.GetAll()[0];
            List<EntryDate> oldListOfContacts = group.GetContact();
            EntryDate entry = EntryDate.GetAll().Except(oldListOfContacts).First();

            AppManager.Contact.AddInGroup(entry, group);

            List<EntryDate> newListOfContacts = group.GetContact();
            oldListOfContacts.Add(entry);
            oldListOfContacts.Sort();
            newListOfContacts.Sort();
            Assert.AreEqual(oldListOfContacts, newListOfContacts);
            

            
        }
        public void TestDBConnectivity()
        {
            //DateTime start = DateTime.Now;
            //List<GroupData> groupFromUI = AppManager.Group.GetGroupList();
            //DateTime end = DateTime.Now;
            //System.Console.Out.WriteLine(end.Subtract(start));

            //start = DateTime.Now;
            //List<GroupData> groupFromBD = GroupData.GetAll();
            //end = DateTime.Now;
            //System.Console.Out.WriteLine(end.Subtract(start));


            foreach (GroupData group in EntryDate.GetAll()[0].GetGroup())
            {
                System.Console.Out.WriteLine(group);
            }
        }
        public void ContactChangeEntryData()
        {
            EntryDate newEntry = new EntryDate("Ivan123", "Ivanov123", "Moscow, Pyshkina 3, room 123");

            newEntry.MiddleName  = "Ivanovich123";
            newEntry.MobilePhone = "777777";
            newEntry.E_mail      = "*****@*****.**";

            AppManager.Contact.CheckPresenceContact(newEntry);
            List <EntryDate> oldContactList = EntryDate.GetAll();

            //Созраняем контакт,который будем изменять
            EntryDate oldContact = oldContactList[3];

            EntryDate changeEntry = new EntryDate("Petr17", "Petrov17", "Moscow, Lenina 101, room 3451");

            changeEntry.MiddleName  = "Petrovich";
            changeEntry.MobilePhone = "123456789";
            changeEntry.E_mail      = "*****@*****.**";

            AppManager.Contact.Edit(oldContact.Id, changeEntry);

            //Быстрая проверка
            Assert.AreEqual(oldContactList.Count, AppManager.Contact.GetContactCount());

            List <EntryDate> newContactList = EntryDate.GetAll();

            AppManager.Contact.CheckContactChangeResultByObj(oldContact, changeEntry, oldContactList, newContactList);

            //Проверяем изменение имени и фамилии по нашему Id
            foreach (EntryDate e in newContactList)
            {
                if (e.Id == oldContact.Id)
                {
                    Assert.AreEqual(changeEntry.FirstName, e.FirstName);
                    Assert.AreEqual(changeEntry.LastName, e.LastName);
                }
            }
        }