public void InsertCategoryTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var categoryDao = new CategoryDao(database); InsertDummyData(categoryDao); Assert.Equal(items.Count, categoryDao.Count()); }
public void FindAllCategoriesTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var categoryDao = new CategoryDao(database); InsertDummyData(categoryDao); Assert.Equal(items.Count, categoryDao.Count()); IList<Category> dbCategories = categoryDao.FindAll(); Assert.NotNull(dbCategories); Assert.Equal(items.Count, dbCategories.Count); foreach (var cat in dbCategories) { Assert.True(items.Contains(cat)); } }
public void FindCategoryByIdTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var categoryDao = new CategoryDao(database); InsertDummyData(categoryDao); Assert.Equal(items.Count, categoryDao.Count()); Category myCateg = categoryDao.FindById(AKROBATIK_ID); Assert.NotNull(myCateg); Assert.Equal(AKROBATIK_LABEL, myCateg.Label); categoryDao.Delete(myCateg.Id); Assert.Equal(3, categoryDao.Count()); }
public void DeleteCategoryTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var categoryDao = new CategoryDao(database); InsertDummyData(categoryDao); Assert.Equal(items.Count, categoryDao.Count()); foreach(var item in items) { categoryDao.Delete(item.Id); } Assert.Equal(0, categoryDao.Count()); }
public void UpdateCategoryTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); CategoryDao categoryDao = new CategoryDao(database); InsertDummyData(categoryDao); Assert.Equal(items.Count, categoryDao.Count()); categoryDao.Update(new Category(COMEDY_ID, CATEGORY_UPDATE_STRING)); var myNewCateg = categoryDao.FindById(COMEDY_ID); Assert.NotNull(myNewCateg); Assert.True(!items.Contains(myNewCateg)); Assert.Equal(CATEGORY_UPDATE_STRING, myNewCateg.Label); }