Ejemplo n.º 1
0
        public void DeleteRestrictionTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var restrictionDao = new RestrictionDao(database);
            InsertDummyData(restrictionDao);
            Assert.Equal(items.Count, restrictionDao.Count());

            foreach (var item in items)
            {
                restrictionDao.Delete(item.Id);
            }
            Assert.Equal(0, restrictionDao.Count());
        }
Ejemplo n.º 2
0
        public void FindRestrictionByIdTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var restrictionDao = new RestrictionDao(database);
            InsertDummyData(restrictionDao);
            Assert.Equal(items.Count, restrictionDao.Count());

            var currRestriction = items[0];

            var myRestriction = restrictionDao.FindById(currRestriction.Id);
            Assert.NotNull(myRestriction);
            Assert.Equal(currRestriction, myRestriction);

            restrictionDao.Delete(myRestriction.Id);
            Assert.Equal(items.Count - 1, restrictionDao.Count());
        }