public void InsertLocationTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var locationDao = new LocationDao(database); InsertDummyData(locationDao); Assert.Equal(items.Count, locationDao.Count()); }
private void CreateTestData() { var loc = new Location(LOCATION_ID, LOCATION); var locationDao = new LocationDao(database); locationDao.Insert(loc); items = new List<Venue>(); items.Add(new Venue(VENUE1_ID, VENUE1_LABEL, VENUE1_SPECTATORS, loc, 0, 0)); items.Add(new Venue(VENUE2_ID, VENUE2_LABEL, VENUE2_SPECTATORS, loc, 0, 0)); items.Add(new Venue(VENUE3_ID, VENUE3_LABEL, VENUE3_SPECTATORS, loc, 0, 0)); }
public void FindAllLocationsTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var locationDao = new LocationDao(database); InsertDummyData(locationDao); Assert.Equal(items.Count, locationDao.Count()); IList<Location> dbLocations = locationDao.FindAll(); Assert.NotNull(dbLocations); Assert.Equal(items.Count, dbLocations.Count); foreach (var loc in dbLocations) { Assert.True(items.Contains(loc)); } }
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 FindLocationByIdTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var locationDao = new LocationDao(database); InsertDummyData(locationDao); Assert.Equal(items.Count, locationDao.Count()); var myLocation = locationDao.FindById(HAUPTPLATZ_ID); Assert.NotNull(myLocation); Assert.Equal(HAUPTPLATZ, myLocation.Label); locationDao.Delete(myLocation.Id); Assert.Equal(items.Count-1, locationDao.Count()); }
public void DeleteLocationTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var locationDao = new LocationDao(database); InsertDummyData(locationDao); Assert.Equal(items.Count, locationDao.Count()); foreach (var item in items) { locationDao.Delete(item.Id); } Assert.Equal(0, locationDao.Count()); }
public void UpdateLocationTest() { IDatabase database = new Database(TestUtils.ConnString); Assert.NotNull(database); var locationDao = new LocationDao(database); InsertDummyData(locationDao); Assert.Equal(items.Count, locationDao.Count()); locationDao.Update(new Location(HAUPTPLATZ_ID, CAP_HAUPPLATZ)); var myNewLoc = locationDao.FindById(HAUPTPLATZ_ID); Assert.NotNull(myNewLoc); Assert.True(!items.Contains(myNewLoc)); Assert.Equal(CAP_HAUPPLATZ, myNewLoc.Label); }