Example #1
0
        public void DeleteMovieInDatabase()
        {
            var options = new DbContextOptionsBuilder <ApplicationDBContext>()
                          .UseNpgsql("User ID=postgres;Password=123;Host=localhost;Port=5432;Database=reactdb;Pooling=true;")
                          .Options;

            using (var context = new ApplicationDBContext(options))
            {
                var service = new MovieDataAccessLayer(context);
                //System.ArgumentNullException : Value cannot be null means id does not exist
                service.DeleteMovie(10);
            }

            using (var context = new ApplicationDBContext(options))
            {
                Assert.AreEqual(8, context.Movie.Count());
            }
        }
Example #2
0
 //[ValidateAntiForgeryToken]
 public IActionResult DeleteConfirmed(int id)
 {
     dal.DeleteMovie(id);
     return(RedirectToAction(nameof(Index)));
 }