public void GetNumberOfReviews(int movie, int expected)
        {
            // arrange
            MovieRatingsService mrs = new MovieRatingsService(Repo);

            // act
            int result = mrs.GetNumberOfReviews(movie);

            // assert
            Assert.AreEqual(expected, result);
        }
コード例 #2
0
        public void GetNumberOfReviews(int movie, int expected)
        {
            ratings = new MovieRating[]
            {
                new MovieRating(1, 2, 3, DateTime.Now),
                new MovieRating(2, 3, 3, DateTime.Now),
                new MovieRating(3, 3, 4, DateTime.Now)
            };
            MovieRatingsService mrs = new MovieRatingsService(repoMock.Object);

            var result = mrs.GetNumberOfReviews(movie);

            Assert.Equal(expected, result);
            repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once);
        }
コード例 #3
0
        public void GetNumberOfReviews(int movie, int expected)
        {
            // arrange
            ratings = new List <MovieRating>()
            {
                new MovieRating(1, 2, 2, DateTime.Now),
                new MovieRating(2, 3, 3, DateTime.Now),
                new MovieRating(3, 3, 4, DateTime.Now),
                new MovieRating(3, 4, 5, DateTime.Now)
            };

            MovieRatingsService mrs = new MovieRatingsService(repoMock.Object);

            // act
            int result = mrs.GetNumberOfReviews(movie);

            // assert
            Assert.Equal(expected, result);
            repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once);
        }