public void GetMoviesTest() { List <Movies> movies = new List <Movies> (); movies = movieDAL.GetMovies(); string query = $"select * from Movies order by rand() limit 1 ;"; Movies movieRand = GetMovieExecQuery(query); string query1 = $"select * from Movies order by movie_id asc limit 1; "; Movies movieTop = GetMovieExecQuery(query1); string query2 = $"select * from Movies order by movie_id desc limit 1;"; Movies movieBottom = GetMovieExecQuery(query2); Assert.NotNull(movies); Assert.NotNull(movieRand); Assert.NotNull(movieTop); Assert.NotNull(movieBottom); // So sanh vi tri Top Bottom va Rand xem co giong trong List. Assert.True(movieTop.Movie_id == movies[0].Movie_id); Assert.True(movieBottom.Movie_id == movies[movies.Count - 1].Movie_id); Assert.Contains(movieRand, movies); }
public List <Movies> GetMovies() { return(dal.GetMovies()); }