public void AverageRatingByReviewer_ZeroNumber_ReturnsAverageRatingZero(int reviewer, double average)
        {
            FakeMovieRatingRepository movieRatingRepository = new FakeMovieRatingRepository();

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

            double actual = movieRatingService.AverageRatingByReviewer(reviewer);

            Assert.Equal(average, actual);
        }
Beispiel #2
0
        public void GetAverageRateFromReviewerWithCorrectValues(int reviewerId, double average)
        {
            FakeMovieRatingRepository fakeRepo = new FakeMovieRatingRepository();

            fakeRepo.AddRating(new Rating()
            {
                ReviewerId = 2, MovieId = 1, Grade = 1, Date = DateTime.Now
            });
            fakeRepo.AddRating(new Rating()
            {
                ReviewerId = 3, MovieId = 1, Grade = 4, Date = DateTime.Now
            });
            fakeRepo.AddRating(new Rating()
            {
                ReviewerId = 3, MovieId = 2, Grade = 1, Date = DateTime.Now
            });
            IMovieRatingService service = new MovieRatingService(fakeRepo);

            double actual = service.AverageRatingByReviewer(reviewerId);

            Assert.Equal(average, actual);
        }