コード例 #1
0
        public void GetCountOfReviewsByReviewer_InvalidNumber_ThrowsArguementException()
        {
            FakeMovieRatingRepository movieRatingRepository = new FakeMovieRatingRepository();
            IMovieRatingService       movieRatingService    = new MovieRatingService(movieRatingRepository);

            Action actual = () => movieRatingService.GetCountOfReviewsByReviewer(-1);

            Assert.Throws <ArgumentException>(actual);
        }
コード例 #2
0
        public void GetCountOfReviewsByReviewer_ValidNumber_ReturnsReviewsOfReviewer(int reviewer, int reviews)
        {
            FakeMovieRatingRepository movieRatingRepository = new FakeMovieRatingRepository();

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

            int actual = movieRatingService.GetCountOfReviewsByReviewer(reviewer);

            Assert.Equal(reviews, actual);
        }