public void GetTopMoviesByAverageGrade_ValidArguments() { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); movieRatingRepository.AddJSON(movieRatingList); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); Assert.True(Time(() => movieRatingService.getTopMoviesByAverageGrade(5)) < 4); }
public void GetTopMoviesByAverageGrader_ValidArguments() { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); movieRatingRepository.Add(new MovieRatings(1, 7, 5, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(1, 6, 5, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(1, 6, 1, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(1, 6, 4, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(1, 5, 3, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(2, 4, 2, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(2, 3, 3, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(3, 2, 1, DateTime.Now)); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); List <int> expected = new List <int>() { 7, 6, 5, 3, 4 }; List <int> actual = movieRatingService.getTopMoviesByAverageGrade(5); Assert.Equal(expected, actual); }