Пример #1
0
        public void TestDaoGroupsCRUD()
        {
            DaoGroups daoGroups = new DaoGroups(connectionString);

            var allGroups = daoGroups.GetAllRecords();
            int count     = allGroups.Count;

            Group group = new Group("ITP-21");

            daoGroups.Create(group);

            allGroups = daoGroups.GetAllRecords();
            Assert.AreEqual(count + 1, allGroups.Count);

            group.ID = allGroups.Last().ID;

            group.Name = "PVP-21";

            daoGroups.Update(group);

            Group updGroup = daoGroups.GetById(group.ID);

            Assert.AreEqual(group, updGroup);

            daoGroups.Delete(group);
            Assert.AreEqual(count, daoGroups.GetAllRecords().Count);
        }
Пример #2
0
        public void TestDaoGroupsCRUD()
        {
            DaoGroups daoGroups = daoFactory.GetDaoGroups();

            Group group = new Group("TPT-22", 2);

            var allGroups = daoGroups.GetAllRecords();
            int count     = allGroups.Count;

            daoGroups.Create(group);

            allGroups = daoGroups.GetAllRecords();
            Assert.AreEqual(count + 1, allGroups.Count);

            group.ID = allGroups.Last().ID;

            group.Name = "PVP-21";

            daoGroups.Update(group);

            Group updGroup = daoGroups.GetById(group.ID);

            Assert.AreEqual(group, updGroup);

            daoGroups.Delete(group);
            Assert.AreEqual(count, daoGroups.GetAllRecords().Count);
        }