public void GetAverageRateOfMovie() { IMovieRatingsService mrs = new MovieRatingsServiceLinq(repository); double seconds = TimeInSeconds(() => { double result = mrs.GetAverageRateOfMovie(movieMostReviews); }); Assert.True(seconds <= 4); }
public void GetAverageRateOfMovieWithReviews(int movie, double expected) { ratings = new MovieRating[] { new MovieRating(1, 2, 3, DateTime.Now), new MovieRating(2, 3, 3, DateTime.Now), new MovieRating(2, 3, 4, DateTime.Now) }; IMovieRatingsService mrs = new MovieRatingsServiceLinq(repoMock.Object); var result = mrs.GetAverageRateOfMovie(movie); Assert.Equal(expected, result); repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once); }
public void GetAverageRatingOfMovieWithNoReviewsExpectArgumentException() { int movie = 2; ratings = new MovieRating[] { new MovieRating(3, 1, 3, DateTime.Now), new MovieRating(3, 3, 4, DateTime.Now) }; IMovieRatingsService mrs = new MovieRatingsServiceLinq(repoMock.Object); Action ac = () => mrs.GetAverageRateOfMovie(movie); ac.Should().Throw <ArgumentException>().WithMessage($"Movie:{movie} has no reviews"); repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once); }
public void GetAverageRateOfMovie() { IMovieRatingsService mrs = new MovieRatingsServiceLinq(repository); mrs.GetAverageRateOfMovie(movieMostReviews); }
public void GetAverageRateOfMovie() { service.GetAverageRateOfMovie(movieMostReviews); }