Exemple #1
0
        public void GroupRemovalTest()
        {
            if (!app.Groups.IsGroupPresent())
            {
                //Создание группы
                GroupCreationTests newGroup = new GroupCreationTests();
                newGroup.SetupApplicationManager();

                IEnumerable <GroupData> grData = GroupCreationTests.RandomGroupDataProvider();
                newGroup.GroupCreationTest(grData.ElementAt(1));
            }

            List <GroupData> oldGroups   = GroupData.GetAll();
            GroupData        toBeRemoved = oldGroups[0];

            app.Groups.Remove(toBeRemoved);
            Assert.AreEqual(oldGroups.Count - 1, app.Groups.GetGroupCount());

            List <GroupData> newGroups = GroupData.GetAll();

            //GroupData toBeRemoved = oldGroups[0];
            oldGroups.RemoveAt(0);
            oldGroups.Sort();
            newGroups.Sort();
            Assert.AreEqual(oldGroups, newGroups);

            foreach (GroupData group in newGroups)
            {
                Assert.AreNotEqual(group.Id, toBeRemoved.Id);
            }
        }
Exemple #2
0
        public void GroupModificationTest()
        {
            if (!app.Groups.IsGroupPresent())
            {
                //Создание группы
                GroupCreationTests newGroup = new GroupCreationTests();
                newGroup.SetupApplicationManager();

                IEnumerable <GroupData> grData = GroupCreationTests.RandomGroupDataProvider();
                newGroup.GroupCreationTest(grData.ElementAt(1));
            }

            List <GroupData> oldGroups = GroupData.GetAll();
            GroupData        oldData   = oldGroups[0];

            //Изменение группы
            GroupData newData = new GroupData(GenerateRandomString(5))
            {
                Header = GenerateRandomString(10),
                Footer = GenerateRandomString(10)
            };

            app.Groups.Modify(oldData, newData);
            Assert.AreEqual(oldGroups.Count, app.Groups.GetGroupCount());

            List <GroupData> newGroups = GroupData.GetAll();

            oldGroups[0].Name = newData.Name;
            oldGroups.Sort();
            newGroups.Sort();
            Assert.AreEqual(oldGroups, newGroups);

            foreach (GroupData group in newGroups)
            {
                if (group.Id == oldData.Id)
                {
                    Assert.AreEqual(newData.Name, group.Name);
                }
            }
        }