public void AddMovieToDBTest() { var movie = new AddMovieCarrier(); movie.Title = "Friday"; movie.DateReleased = DateTime.Parse("11/02/1995"); movie.MPAARatingID = "4"; movie.GenreID = "5"; movie.RunTime = "120"; movie.StudioID = "1"; movie.Synopsis = "Two homies, Smokey and Craig, smoke up a dope dealers weed and try to figure a way to get the $200 they owe the dope dealer by 10:00pm that night. In that time they smoke weed, get jacked, and they get shot at in a drive-by."; movie.OwnerRatingID = "5"; movie.Copies = "2"; movie.ImageURL = "http://www.imdb.com/media/rm3404111360/tt0113118?ref_=tt_ov_i"; movie.DirectorID = new List<string>() {"1", "2"}; movie.ActorID = new List<string>() {"1", "2", "3"}; var ops = new DVDLibraryOperations(); ops.AddMovie(movie); var movieAdded = new ViewMovieCarrier(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { movieAdded = cn.Query<ViewMovieCarrier>("SELECT * FROM Movies m WHERE m.Title = 'Friday'").FirstOrDefault(); } Assert.AreEqual(movieAdded.Title, movie.Title); }
public ActionResult MovieToRepo(AddMovieCarrier newMovie) { var ops = new DVDLibraryOperations(); ops.AddMovie(newMovie); return RedirectToAction("ViewCollection"); }