public void AddMovieToBookWithNoBookShouldReturnNotFoundView()
        {
            Book book = TestUtil.generateBook();

            book.Title         = "Jurassic Park";
            book.OriginalTitle = "Jurassic Park";
            AddMedia(book);

            Movie movie = TestUtil.generateMovie();

            movie.Title         = "Jurassic Park";
            movie.OriginalTitle = "Jurassic Park";
            AddMedia(movie);

            MediaController mediaController = new MediaController();

            FormCollection collection = new FormCollection();

            collection["BooksForMovie"] = "-1";

            ViewResult result = mediaController.AddMovieToBook(collection, book.Id) as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("NotFound", result.ViewName);
        }
        public void AddMovieToBookShouldConnectAndReturnBookView()
        {
            Book book = TestUtil.generateBook();

            book.Title         = "Jurassic Park";
            book.OriginalTitle = "Jurassic Park";
            AddMedia(book);

            Movie movie = TestUtil.generateMovie();

            movie.Title         = "Jurassic Park";
            movie.OriginalTitle = "Jurassic Park";
            AddMedia(movie);

            MediaController mediaController = new MediaController();

            FormCollection collection = new FormCollection();

            collection["MovieForBook"] = movie.Id.ToString();

            RedirectToRouteResult result = mediaController.AddMovieToBook(collection, book.Id) as RedirectToRouteResult;

            Assert.AreEqual(book.Id, movie.Book.Id);
            Assert.AreEqual(movie.Id, book.Movie.Id);
            Assert.IsNotNull(result);
            object bookId;

            Assert.IsTrue(result.RouteValues.TryGetValue("id", out bookId));
            Assert.AreEqual(book.Id, (int)bookId);
        }