public void FindMoviesForBookShouldReturnNotFoundView()
        {
            MediaController mediaController = new MediaController();

            ViewResult result = mediaController.FindMoviesForBook(1) as ViewResult;

            Assert.IsNotNull(result);

            Assert.AreEqual(notFoundView, result.ViewName);
        }
        public void FindMoviesForBookWithMovieMatchShouldReturnAddMovieForBookView()
        {
            Book book = TestUtil.generateBook();

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

            Movie movie1 = TestUtil.generateMovie();

            movie1.Title         = "Park";
            movie1.OriginalTitle = "Park";
            AddMedia(movie1);
            Movie movie2 = TestUtil.generateMovie();

            movie2.Title         = "Jurassic";
            movie2.OriginalTitle = "Jurassic";
            AddMedia(movie2);
            Movie movie3 = TestUtil.generateMovie();

            movie3.Title         = "Not Related";
            movie3.OriginalTitle = "Not Related";
            AddMedia(movie3);

            MediaController mediaController = new MediaController();

            ViewResult result = mediaController.FindMoviesForBook(book.Id) as ViewResult;

            Assert.IsNotNull(result);

            SelectList selectList = result.ViewData["MoviesForBook"] as SelectList;

            Assert.IsNotNull(selectList);

            var movieTitles = from item in selectList
                              select item.Text;

            Assert.AreEqual(2, selectList.Count <SelectListItem>());
            Assert.IsTrue(movieTitles.Contains <String>("Park"));
            Assert.IsTrue(movieTitles.Contains <String>("Jurassic"));
            Assert.AreEqual(returnView, result.ViewName);
        }
        public void FindMoviesForBookWithoutMovieMatchShouldReturnAddMovieForBookView()
        {
            Book book = TestUtil.generateBook();

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

            Movie movie1 = TestUtil.generateMovie();

            movie1.Title = "ASE";
            movie1.Title = "ASE";
            AddMedia(movie1);
            Movie movie2 = TestUtil.generateMovie();

            movie2.Title = "FCK";
            movie2.Title = "FCK";
            AddMedia(movie2);
            Movie movie3 = TestUtil.generateMovie();

            movie3.Title = "Not Related";
            movie3.Title = "Not Related";
            AddMedia(movie3);

            MediaController mediaController = new MediaController();

            ViewResult result = mediaController.FindMoviesForBook(book.Id) as ViewResult;

            Assert.IsNotNull(result);

            SelectList selectList = result.ViewData["MoviesForBook"] as SelectList;

            Assert.IsNotNull(selectList);

            Assert.AreEqual(0, selectList.Count <SelectListItem>());
            Assert.AreEqual(returnView, result.ViewName);
        }