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); }
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)); }