public void InvalidMovieID_ThrowsArgumentException()
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();
            IMovieRatingService   movieRatingService    = new MovieRatingService(movieRatingRepository);

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

            Assert.Throws <ArgumentException>(actual);
        }
示例#2
0
        public void GetCountOfMovieReviewers_ValidArguments( )
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

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

            Assert.True(Time(() => movieRatingService.getCountOfMovieReviewers(1)) < 4);
        }
        public void GetCountOfMovieReviewers_ValidArguments(int movie, int count)
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

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

            int actual = movieRatingService.getCountOfMovieReviewers(movie);

            Assert.Equal(count, actual);
        }