Ejemplo n.º 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());
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }