Exemplo n.º 1
0
        public void GetAverageRateGivenByReviewer_ValidArguments( )
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

            movieRatingRepository.AddJSON(movieRatingList);
            IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository);

            Assert.True(Time(() => movieRatingService.getAverageRateGivenByReviewer(5)) < 4);
        }
Exemplo n.º 2
0
        public void GetAverageRateGivenByReviewer_ValidArguments_ReturnZero(int reviewer, double average)
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

            movieRatingRepository.Add(new MovieRatings(1, 1, 2, DateTime.Now));
            movieRatingRepository.Add(new MovieRatings(2, 2, 4, DateTime.Now));
            movieRatingRepository.Add(new MovieRatings(2, 3, 1, DateTime.Now));
            movieRatingRepository.Add(new MovieRatings(2, 4, 1, DateTime.Now));
            IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository);

            double actual = movieRatingService.getAverageRateGivenByReviewer(reviewer);

            Assert.Equal(average, actual);
        }