public void InvalidReviewerID_ThrowsArgumentException() { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); Action actual = () => movieRatingService.getNumberOfReviewsFromReviewer(-1); Assert.Throws <ArgumentException>(actual); }
public void GetNumberOfReviewsFromReviewer_ValidArguments() { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); movieRatingRepository.AddJSON(movieRatingList); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); Assert.True(Time(() => movieRatingService.getNumberOfReviewsFromReviewer(2)) < 4); }
public void GetNumberOfReviewsFromReviewer_BaitClass() { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); movieRatingRepository.AddJSON(movieRatingList); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); Assert.False(Time(() => movieRatingService.getNumberOfReviewsFromReviewer(1)) < 0); }
public void GetNumberOfReviewsFromReviewer_ValidArguments(int reviewer, int reviews) { MovieReviewRepository movieRatingRepository = new MovieReviewRepository(); movieRatingRepository.Add(new MovieRatings(1, 3, 2, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(1, 1, 2, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(2, 2, 2, DateTime.Now)); movieRatingRepository.Add(new MovieRatings(2, 3, 2, DateTime.Now)); IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository); int actual = movieRatingService.getNumberOfReviewsFromReviewer(reviewer); Assert.Equal(reviews, actual); }