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

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

            Assert.True(Time(() => movieRatingService.getAllMoviesByReviewer(1)) < 4);
        }
コード例 #2
0
        public void GetMoviesByReviewer_ValidArguments()
        {
            MovieReviewRepository movieRatingRepository = new MovieReviewRepository();
            MovieRatings          movieRating1          = new MovieRatings(1, 1, 5, DateTime.Now.AddYears(4));
            MovieRatings          movieRating2          = new MovieRatings(2, 1, 5, DateTime.Now.AddYears(3));
            MovieRatings          movieRating3          = new MovieRatings(3, 1, 4, DateTime.Now.AddYears(3));
            MovieRatings          movieRating4          = new MovieRatings(4, 1, 3, DateTime.Now.AddYears(2));
            MovieRatings          movieRating5          = new MovieRatings(3, 2, 1, DateTime.Now);

            movieRatingRepository.Add(movieRating1);
            movieRatingRepository.Add(movieRating2);
            movieRatingRepository.Add(movieRating3);
            movieRatingRepository.Add(movieRating4);
            movieRatingRepository.Add(movieRating5);
            IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepository);

            List <MovieRatings> expected = new List <MovieRatings>()
            {
                movieRating1
            };
            List <MovieRatings> actual = movieRatingService.getAllMoviesByReviewer(1);

            Assert.Equal(expected, actual);
        }