示例#1
0
        public void GetMostProductiveReviewers()
        {
            // arrange

            ratings = new List <MovieRating>()
            {
                new MovieRating(1, 1, 5, DateTime.Now),
                new MovieRating(1, 2, 5, DateTime.Now),
                new MovieRating(1, 3, 5, DateTime.Now),

                new MovieRating(2, 1, 4, DateTime.Now),
                new MovieRating(2, 2, 5, DateTime.Now),
                new MovieRating(2, 3, 5, DateTime.Now),
                new MovieRating(2, 4, 5, DateTime.Now),

                new MovieRating(3, 3, 5, DateTime.Now)
            };

            MovieRatingsService mrs = new MovieRatingsService(repoMock.Object);

            List <int> expected = new List <int>()
            {
                2, 1, 3
            };

            // act
            var result = mrs.GetMostProductiveReviewers();

            // assert
            Assert.Equal(expected, result);
            repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once);
        }
        public void GetMostProductiveReviewers()
        {
            // arrange
            MovieRatingsService mrs      = new MovieRatingsService(Repo);
            List <int>          expected = new List <int>()
            {
                571, 30, 457, 886, 758
            };

            // act
            var result = mrs.GetMostProductiveReviewers().GetRange(0, 5);

            // assert
            CollectionAssert.AreEqual(expected, result);
        }
示例#3
0
        public void GetMostProductiveReviewers()
        {
            ratings = new MovieRating[]
            {
                new MovieRating(1, 2, 3, DateTime.Now),
                new MovieRating(1, 3, 4, DateTime.Now),
                new MovieRating(2, 3, 1, DateTime.Now),
                new MovieRating(3, 4, 2, DateTime.Now),
                new MovieRating(3, 3, 1, DateTime.Now),
            };

            MovieRatingsService mrs = new MovieRatingsService(repoMock.Object);

            var expected = new List <int>()
            {
                1, 3
            };

            var result = mrs.GetMostProductiveReviewers();

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