コード例 #1
0
        public void AverageRatingOnMovie_ValidNumber_ReturnsAverageRatingZero(int movie, double average)
        {
            FakeMovieRatingRepository movieRatingRepository = new FakeMovieRatingRepository();

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

            double actual = movieRatingService.AverageRatingOnMovie(movie);

            Assert.Equal(average, actual);
        }