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()); }
private void CreateTestData() { var cat = new Category(COMEDY_ID, COMEDY_LABEL); var categoryDao = new CategoryDao(database); categoryDao.Insert(cat); items = new List<Artist>(); items.Add(new Artist(ARTIST1_ID, ARTIST1_NAME, ARTIST1_COUNTRY, ARTIST1_MAIL, "", "", "", "", cat, false)); items.Add(new Artist(ARTIST2_ID, ARTIST2_NAME, ARTIST2_COUNTRY, ARTIST2_MAIL, "", "", "", "", cat, false)); items.Add(new Artist(ARTIST3_ID, ARTIST3_NAME, ARTIST3_COUNTRY, ARTIST3_MAIL, "", "", "", "", cat, false)); }
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)); } }
private void CreateTestData() { var loc = new Location(LOCATION_ID, LOCATION); var locationDao = new LocationDao(database); locationDao.Insert(loc); var venue = new Venue(VENUE_ID, VENUE_LABEL, VENUE_SPECTATORS, loc, 0, 0); var venueDao = new VenueDao(database); venueDao.Insert(venue); var category = new Category(CATEGORY_ID, CATEGORY_LABEL); var categoryDao = new CategoryDao(database); categoryDao.Insert(category); items = new List<Restriction>(); items.Add(new Restriction(1, RESTRICTION1_START, RESTRICTION1_STOP, venue, category)); items.Add(new Restriction(2, RESTRICTION2_START, RESTRICTION2_STOP, venue, category)); items.Add(new Restriction(3, RESTRICTION3_START, RESTRICTION3_STOP, venue, category)); items.Add(new Restriction(4, RESTRICTION4_START, RESTRICTION4_STOP, venue, category)); }
private void CreateTestData() { var loc = new Location(LOCATION_ID, LOCATION); var locationDao = new LocationDao(database); locationDao.Insert(loc); var venue = new Venue(VENUE_ID, VENUE_LABEL, VENUE_SPECTATORS, loc, 0, 0); var venueDao = new VenueDao(database); venueDao.Insert(venue); var category = new Category(CATEGORY_ID, CATEGORY_LABEL); var categoryDao = new CategoryDao(database); categoryDao.Insert(category); var artist = new Artist(ARTIST_ID, ARTIST_NAME, ARTIST_COUNTRY, ARTIST_MAIL, "", "", "", "", category, false); var artistDao = new ArtistDao(database); artistDao.Insert(artist); items = new List<Performance>(); items.Add(new Performance(1, PERFORMANCE1_START, artist, venue)); items.Add(new Performance(2, PERFORMANCE2_START, artist, venue)); items.Add(new Performance(3, PERFORMANCE3_START, artist, venue)); items.Add(new Performance(4, PERFORMANCE4_START, artist, venue)); }
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); }