Exemplo n.º 1
0
        public void TestFilterMovies()
        {
            List <Movie> movies = new List <Movie>
            {
                new Movie(1, "Shrek", DateTime.Now, 2000, 67),
                new Movie(2, "Shrek 2", DateTime.Now, 2000, 62),
                new Movie(3, "Transformers", DateTime.Now, 2000, 87),
                new Movie(4, "Harry Potter", DateTime.Now, 2000, 57),
            };

            movies = logic.Filtermovie(movies, "Shrek");
            Assert.Equal(2, movies.Count);
        }
Exemplo n.º 2
0
        public ActionResult FilterMovies(string Title)
        {
            List <Movie> movies = _context.GetMovies();

            MovieIndexViewModel viewModel = new MovieIndexViewModel
            {
                Account = HttpContext.Session.GetObject <Account>("User"),
                Movies  = _context.Filtermovie(movies, Title)
            };

            if (viewModel.Movies.Count == 0)
            {
                viewModel.Message = "No movies found";
            }
            return(View("Index", viewModel));
        }