public void TestAddMovieToMedia() { AddMovies(1); MediaLibContainer context = ContextHelper <MediaLibContainer> .GetCurrentContext(); Movie movie = context.MediaSet.OfType <Movie>().First <Movie>(); int expectedMovieId = movie.Id; MediaController mediaController = new MediaController(); FormCollection collection = new FormCollection(); collection["ctl00$MainContent$MovieTitle"] = movie.Title; collection["ctl00$MainContent$MovieTitleOriginal"] = movie.OriginalTitle; collection["GenreList"] = movie.Genre; collection["ctl00$MainContent$Datepicker"] = movie.ReleaseDate.ToShortDateString(); ViewResult result = mediaController.AddMovieToDb(collection, fakeUser) as ViewResult; Movie m = MediaService.Instance.GetMovieById(movie.Id); addedMedia.Add(m); Assert.IsNotNull(m); Assert.AreEqual(expectedMovieId, m.Id); }