Example #1
0
        public void InsertVenueTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());
        }
Example #2
0
        public void FindAllVenuesTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            IList<Venue> dbVenues = venueDao.FindAll();
            Assert.NotNull(dbVenues);
            Assert.Equal(items.Count, dbVenues.Count);

            foreach (var venue in dbVenues)
            {
                Assert.True(items.Contains(venue));
            }
        }
Example #3
0
        public void FindVenueByIdTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            var currVenue = items[0];

            var myVenue = venueDao.FindById(currVenue.Id, currVenue.Location.Id);
            Assert.NotNull(myVenue);
            Assert.Equal(currVenue, myVenue);

            venueDao.Delete(myVenue.Id, myVenue.Location.Id);
            Assert.Equal(items.Count - 1, venueDao.Count());
        }
Example #4
0
        public void DeleteVenueTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            foreach (var item in items)
            {
                venueDao.Delete(item.Id, item.Location.Id);
            }
            Assert.Equal(0, venueDao.Count());
        }
Example #5
0
        public void UpdateVenueTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            var currVenue = items[0];
            currVenue.Label = ALTER_LABEL;

            venueDao.Update(currVenue);
            var myNewVenue = venueDao.FindById(currVenue.Id, currVenue.Location.Id);
            Assert.NotNull(myNewVenue);
            Assert.Equal(ALTER_LABEL, myNewVenue.Label);
        }
Example #6
0
        public void FindVenueWhereSpecatorsTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            var currVenue = items[0];

            var venues = venueDao.FindWhereSpectators(50);
            Assert.NotNull(venues);
            Assert.Equal(2, venues.Count);
        }
Example #7
0
        public void FindVenueByLocationIdTest()
        {
            if (database == null)
            {
                database = new Database(TestUtils.ConnString);
            }
            Assert.NotNull(database);

            var venueDao = new VenueDao(database);
            InsertDummyData(venueDao);
            Assert.Equal(items.Count, venueDao.Count());

            var currVenue = items[0];

            var venues = venueDao.FindByLocationId(LOCATION_ID);
            Assert.NotNull(venues);
            Assert.Equal(items.Count, venues.Count);
        }