コード例 #1
0
        public void GetAverageRateGivenByReviewer(int reviewerId, double averageRate)
        {
            MovieRatingRepository movieRatingRepo = new MovieRatingRepository();

            movieRatingRepo.Add(new MovieRating(1, 2, 5, DateTime.Now));
            movieRatingRepo.Add(new MovieRating(1, 1, 3, DateTime.Now));
            movieRatingRepo.Add(new MovieRating(2, 2, 4, DateTime.Now));
            movieRatingRepo.Add(new MovieRating(3, 3, 2, DateTime.Now));
            movieRatingRepo.Add(new MovieRating(2, 3, 4, DateTime.Now));
            movieRatingRepo.Add(new MovieRating(3, 1, 4, DateTime.Now));

            IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepo);

            double actual = movieRatingService.GetAverageRateGivenByReviewer(reviewerId);

            double expected = averageRate;

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void GetAverageRateGivenByReviewer()
        {
            IMovieRatingService movieRatingService = new MovieRatingService(mRepo);

            CheckPerformance(() => movieRatingService.GetAverageRateGivenByReviewer(3), 4000);
        }