public void GetAverageRateFromReviewer()
        {
            IMovieRatingsService mrs = new MovieRatingsServiceLinq(repository);

            double seconds = TimeInSeconds(() =>
            {
                double result = mrs.GetAverageRateFromReviewer(reviewerMostReviews);
            });

            Assert.True(seconds <= 4);
        }
        public void GetAverageRateFromReviewerWithReviews(int reviewer, double expected)
        {
            ratings = new MovieRating[]
            {
                new MovieRating(2, 1, 3, DateTime.Now),
                new MovieRating(3, 1, 3, DateTime.Now),
                new MovieRating(3, 2, 4, DateTime.Now)
            };
            IMovieRatingsService mrs = new MovieRatingsServiceLinq(repoMock.Object);

            var result = mrs.GetAverageRateFromReviewer(reviewer);

            Assert.Equal(expected, result);
            repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once);
        }
        public void GetAverageRatingFromReviewerWithNoReviewsExpectArgumentException()
        {
            int reviewer = 2;

            ratings = new MovieRating[]
            {
                new MovieRating(3, 1, 3, DateTime.Now),
                new MovieRating(3, 2, 4, DateTime.Now)
            };
            IMovieRatingsService mrs = new MovieRatingsServiceLinq(repoMock.Object);

            Action ac = () => mrs.GetAverageRateFromReviewer(reviewer);

            ac.Should().Throw <ArgumentException>().WithMessage($"Reviewer:{reviewer} has no reviews");
            repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once);
        }
Beispiel #4
0
        public void GetAverageRateFromReviewer()
        {
            IMovieRatingsService mrs = new MovieRatingsServiceLinq(repository);

            mrs.GetAverageRateFromReviewer(reviewerMostReviews);
        }