コード例 #1
0
        public void GetCountOfGradesGottenByMovie_ValidArgumentse()
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

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

            Assert.True(Time(() => movieRatingService.getCountOfGradesGottenByMovie(9, 1)) < 4);
        }
コード例 #2
0
        public void InvalidGrade_ThrowsArgumentException(int movie, int grade)
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

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

            Action actual = () => movieRatingService.getCountOfGradesGottenByMovie(movie, grade);

            Assert.Throws <ArgumentException>(actual);
        }
コード例 #3
0
        public void GetCountOfGradesGottenByMovie_ValidArgumentse(int movie, int grade, int count)
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();

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

            int actual = movieRatingService.getCountOfGradesGottenByMovie(movie, grade);

            Assert.Equal(count, actual);
        }