public void GetTopRatedMovies(int amount, int[] expected) { //arrange IRepository <Rating> repo = repoMock.Object; MovieRatingService mrs = new MovieRatingService(repo); dataStore = new List <Rating> { new Rating(1, 1, 5, new DateTime(2003, 6, 6)), new Rating(1, 1, 5, new DateTime(2003, 6, 6)), new Rating(1, 1, 5, new DateTime(2003, 6, 6)), new Rating(1, 2, 4, new DateTime(2003, 6, 6)), new Rating(1, 2, 4, new DateTime(2003, 6, 6)), new Rating(1, 2, 4, new DateTime(2003, 6, 6)), new Rating(1, 3, 4, new DateTime(2003, 6, 6)), new Rating(1, 3, 4, new DateTime(2003, 6, 6)), new Rating(1, 3, 4, new DateTime(2003, 6, 6)), }; List <int> TopRatedMoviesExpected = new List <int>(expected); //act List <int> MostProductiveReviewers = mrs.GetTopRatedMovies(amount); //assert Assert.Equal(TopRatedMoviesExpected, MostProductiveReviewers); repoMock.Verify(rep => rep.GetAll(), Times.Once); }
public void GetTopRatedMovies(int amount, int expectedLowestMovie) { ratings = new List <MovieRating>() { new MovieRating(1, 1, 1, DateTime.Now), new MovieRating(1, 2, 2, DateTime.Now), new MovieRating(1, 3, 3, DateTime.Now), new MovieRating(1, 4, 4, DateTime.Now), new MovieRating(1, 5, 5, DateTime.Now), new MovieRating(2, 1, 1, DateTime.Now), new MovieRating(2, 2, 2, DateTime.Now), new MovieRating(2, 3, 3, DateTime.Now), new MovieRating(2, 4, 4, DateTime.Now), new MovieRating(2, 5, 5, DateTime.Now), new MovieRating(3, 1, 1, DateTime.Now), new MovieRating(3, 2, 2, DateTime.Now), new MovieRating(3, 3, 3, DateTime.Now), new MovieRating(3, 4, 4, DateTime.Now), new MovieRating(3, 5, 5, DateTime.Now), }; IMovieRatingService mrs = new MovieRatingService(repoMock.Object); List <int> results = mrs.GetTopRatedMovies(amount); Assert.Equal(expectedLowestMovie, results[amount - 1]); repoMock.Verify(r => r.Ratings, Times.Once); }
public void GetTopRatedMovies() { MovieRatingService service = new MovieRatingService(repo); var result = service.GetTopRatedMovies(100000); Assert.IsNotNull(result); }
public void GetTopRatedMovies(int amount) { MovieRatingService mrs = new MovieRatingService(_repo); double seconds = TimeInSeconds(() => { List <int> result = mrs.GetTopRatedMovies(amount); }); Assert.True(seconds <= MAX_SECONDS); }
public void GetTopRatedMovies(int n, int[] expected) { ratings = new List <MovieRating>() { new MovieRating(1, 2, 3, DateTime.Now), // movie 1 avg = 4 new MovieRating(1, 3, 2, DateTime.Now), // movie 2 avg = 3 new MovieRating(2, 1, 4, DateTime.Now), // movie 3 avg = 2.5 new MovieRating(2, 3, 3, DateTime.Now), // movie 4 avg = 4.5 new MovieRating(2, 4, 4, DateTime.Now), new MovieRating(3, 4, 5, DateTime.Now) }; MovieRatingService mrs = new MovieRatingService(repoMock.Object); var result = mrs.GetTopRatedMovies(n); Assert.Equal(new List <int>(expected), result); repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once); }
public void GetTopRatedMovies(int amount, int[] expected) { List <int> expectedList = new List <int>(expected); // arrange ratings = new List <MovieRating>() { new MovieRating(1, 1, 3, DateTime.Now), new MovieRating(2, 1, 5, DateTime.Now), new MovieRating(1, 2, 2, DateTime.Now), new MovieRating(2, 2, 5, DateTime.Now), new MovieRating(1, 3, 4, DateTime.Now), }; MovieRatingService mrs = new MovieRatingService(repoMock.Object); // act List <int> result = mrs.GetTopRatedMovies(amount); // assert Assert.Equal(expectedList, result); repoMock.Verify(repo => repo.Ratings, Times.Once); }
public void GetTopRatedMovies() { MovieRatingService mrs = new MovieRatingService(repository); mrs.GetTopRatedMovies(20); }
public void GetTopRatedMovies() { IMovieRatingService movieRatingService = new MovieRatingService(mRepo); CheckPerformance(() => movieRatingService.GetTopRatedMovies(), 4000); }
public void GetTopRatedMoviesTest(int amount) { MovieRatingService movieRatingService = new MovieRatingService(repo); List <int> result = movieRatingService.GetTopRatedMovies(amount); }