Пример #1
0
        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());
        }
Пример #2
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));
            }
        }
Пример #3
0
        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());
        }
Пример #4
0
        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());
        }
Пример #5
0
        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);
        }