Exemple #1
0
        //delete method
        public void DeleteBar(int id)
        {
            var orig = _barRepo.GetBarById(id);

            _barRepo.Delete(orig);
            _barRepo.SaveChanges();
        }
Exemple #2
0
        public void BarRepository_DeleteExistingBar_BarNoLongerInDB()
        {
            var bar = new Bar()
            {
                BarName          = "New bar",
                Address          = "FakeAddress",
                AgeLimit         = 18,
                AvgRating        = 0,
                CVR              = 88888888,
                PhoneNumber      = 12345678,
                Educations       = "IKT",
                Email            = "Fake@email",
                ShortDescription = "Short description",
                LongDescription  = "Long description",
                Image            = "FakeImg"
            };

            _repository.Add(bar);
            _context.SaveChanges();


            _repository.Delete("New bar");
            _context.SaveChanges();
            Assert.AreEqual(null, _repository.Get("New bar"));
        }