public void GetMostProductiveReviewers() { ratings = new List <MovieRating>() { new MovieRating(1, 1, 1, DateTime.Now), new MovieRating(1, 2, 1, DateTime.Now), new MovieRating(2, 1, 1, DateTime.Now), new MovieRating(2, 2, 1, DateTime.Now), new MovieRating(2, 3, 1, DateTime.Now), new MovieRating(3, 1, 1, DateTime.Now), new MovieRating(3, 2, 1, DateTime.Now), new MovieRating(3, 3, 1, DateTime.Now), }; IMovieRatingService mrs = new MovieRatingService(repoMock.Object); List <int> expected = new List <int>() { 2, 3 }; List <int> result = mrs.GetMostProductiveReviewers(); Assert.Equal(expected, result); repoMock.Verify(r => r.Ratings, Times.Once); }
public void GetMostProductiveReviewers() { ratings = new List <MovieRating>() { new MovieRating(2, 1, 5, DateTime.Now), new MovieRating(2, 2, 5, DateTime.Now), new MovieRating(2, 3, 4, DateTime.Now), new MovieRating(2, 4, 5, DateTime.Now), new MovieRating(3, 2, 5, DateTime.Now), new MovieRating(3, 3, 5, DateTime.Now), new MovieRating(4, 3, 5, DateTime.Now), new MovieRating(4, 4, 5, DateTime.Now), new MovieRating(4, 5, 5, DateTime.Now), new MovieRating(4, 6, 5, DateTime.Now), }; MovieRatingService mrs = new MovieRatingService(repoMock.Object); List <int> expected = new List <int>() { 2, 4 }; var result = mrs.GetMostProductiveReviewers(); Assert.Equal(expected, result); repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once); }
public void GetMostProductiveReviewers() { MovieRatingService service = new MovieRatingService(repo); var result = service.GetMostProductiveReviewers(); Assert.IsNotNull(result); }
public void GetMostProductiveReviewersTest() { MovieRatingService movieRatingService = new MovieRatingService(repo); List <int> result = movieRatingService.GetMostProductiveReviewers(); foreach (int reviewer in result) { Console.WriteLine(reviewer); } }
public void GetMostProductiveReviewers() { MovieRatingService mrs = new MovieRatingService(_repo); double seconds = TimeInSeconds(() => { List <int> result = mrs.GetMostProductiveReviewers(); }); Assert.True(seconds <= MAX_SECONDS); }
public void GetMostProductiveReviewers() { //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, 3, 3, new DateTime(2005, 9, 6)), new Rating(1, 4, 4, new DateTime(2004, 12, 23)), new Rating(1, 6, 2, new DateTime(2005, 1, 23)), new Rating(3, 5, 2, new DateTime(2005, 2, 23)), new Rating(4, 5, 2, new DateTime(2005, 3, 23)), new Rating(5, 5, 5, new DateTime(2005, 4, 23)), new Rating(6, 5, 3, new DateTime(2005, 5, 23)), new Rating(2, 2, 3, new DateTime(2002, 1, 22)), new Rating(2, 3, 4, new DateTime(2001, 12, 1)), new Rating(7, 1, 5, new DateTime(2003, 6, 6)), new Rating(7, 3, 3, new DateTime(2005, 9, 6)), new Rating(7, 4, 4, new DateTime(2004, 12, 23)), new Rating(7, 6, 2, new DateTime(2005, 1, 23)) }; List <int> MostProductiveReviewersExpected = new List <int> { 1, 7 }; //act List <int> MostProductiveReviewers = mrs.GetMostProductiveReviewers(); Assert.Equal(MostProductiveReviewersExpected, MostProductiveReviewers); repoMock.Verify(rep => rep.GetAll(), Times.Once); }
public void GetTopRatedMovies() { MovieRatingRepository movieRatingRepo = new MovieRatingRepository(); movieRatingRepo.Add(new MovieRating(1, 2, 5, DateTime.Now)); movieRatingRepo.Add(new MovieRating(1, 3, 3, DateTime.Now)); movieRatingRepo.Add(new MovieRating(2, 3, 3, DateTime.Now)); movieRatingRepo.Add(new MovieRating(4, 3, 3, DateTime.Now)); movieRatingRepo.Add(new MovieRating(2, 2, 4, DateTime.Now)); movieRatingRepo.Add(new MovieRating(3, 1, 5, DateTime.Now)); movieRatingRepo.Add(new MovieRating(1, 1, 2, DateTime.Now)); movieRatingRepo.Add(new MovieRating(3, 3, 5, DateTime.Now)); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepo); List <int> actual = movieRatingService.GetMostProductiveReviewers(); List <int> expected = new List <int> { 2, 1, 3 }; Assert.Equal(expected, actual); }
public void GetMostProductiveReviewers() { IMovieRatingService movieRatingService = new MovieRatingService(mRepo); CheckPerformance(() => movieRatingService.GetMostProductiveReviewers(), 4000); }