public void GetNumberOfReviewsFromReviewerTest(int reviewer) { MovieRatingService movieRatingService = new MovieRatingService(repo); int result = movieRatingService.GetNumberOfReviewsFromReviewer(reviewer); Console.WriteLine(result); }
public void GetNumberOfReviewsFromReviewerTest(int reviewerid, int expected) { //arrange IRepository <Rating> repo = repoMock.Object; MovieRatingService mrs = new MovieRatingService(repo); dataStore = new List <Rating> { new Rating(1, 1, 2, new DateTime(2003, 6, 6)), new Rating(1, 3, 3, new DateTime(2005, 9, 6)), new Rating(1, 4, 4, new DateTime(2004, 12, 23)), new Rating(1, 6, 2, new DateTime(2005, 1, 23)), new Rating(3, 5, 2, new DateTime(2005, 2, 23)), new Rating(4, 5, 2, new DateTime(2005, 3, 23)), new Rating(5, 5, 2, new DateTime(2005, 4, 23)), new Rating(6, 5, 2, new DateTime(2005, 5, 23)), new Rating(2, 2, 3, new DateTime(2002, 1, 22)), new Rating(2, 3, 4, new DateTime(2001, 12, 1)) }; //act int NumberOfReviews = mrs.GetNumberOfReviewsFromReviewer(reviewerid); //assert Assert.Equal(expected, NumberOfReviews); repoMock.Verify(rep => rep.GetAll(), Times.Once); }
public void GetNumberofReviewsFromReviewer() { MovieRatingService service = new MovieRatingService(repo); var result = service.GetNumberOfReviewsFromReviewer(100000); Assert.IsNotNull(result); }
public void GetNumberOfReviewsFromReviewer() { MovieRatingService mrs = new MovieRatingService(_repo); double seconds = TimeInSeconds(() => { int result = mrs.GetNumberOfReviewsFromReviewer(_reviewerMostReviews); }); Assert.True(seconds <= MAX_SECONDS); }
public void GetNumberOfReviewsFromReviewer(int reviewer, int expected) { // arrange ratings = new List <MovieRating>() { new MovieRating(2, 1, 3, DateTime.Now), new MovieRating(3, 1, 3, DateTime.Now), new MovieRating(3, 2, 3, DateTime.Now), new MovieRating(4, 2, 3, DateTime.Now) }; IMovieRatingService mrs = new MovieRatingService(repoMock.Object); // act int result = mrs.GetNumberOfReviewsFromReviewer(reviewer); // assert Assert.Equal(result, expected); repoMock.Verify(r => r.Ratings, Times.Once); //sikrer at repository bruges (bliver omdirigeret til repomock) }
public void GetNumberOfReviewsFromReviewer(int reviewer, int expected) { // arrange ratings = new List <MovieRating>() { new MovieRating(2, 1, 3, DateTime.Now), new MovieRating(3, 1, 4, DateTime.Now), new MovieRating(3, 2, 3, DateTime.Now), new MovieRating(4, 1, 4, DateTime.Now) }; MovieRatingService mrs = new MovieRatingService(repoMock.Object); // act int result = mrs.GetNumberOfReviewsFromReviewer(reviewer); // assert Assert.Equal(expected, result); repoMock.Verify(repo => repo.GetAllMovieRatings(), Times.Once); }
public void GetNumberOfReviewsFromReviewerTest(int reviewerId, int numberOfReviews) { //Creating object of MovieRatingRepository class to call methods. MovieRatingRepository movieRatingRepo = new MovieRatingRepository(); //Adding movie rating objects to list. This is mock data. (movieId, reviewerId, grade, releaseDate) movieRatingRepo.Add(new MovieRating(1, 2, 5, DateTime.Now)); movieRatingRepo.Add(new MovieRating(1, 1, 3, DateTime.Now)); movieRatingRepo.Add(new MovieRating(2, 2, 4, DateTime.Now)); movieRatingRepo.Add(new MovieRating(3, 3, 2, DateTime.Now)); movieRatingRepo.Add(new MovieRating(2, 3, 4, DateTime.Now)); //Creating object of MovieRatingService class to call methods. IMovieRatingService movieRatingService = new MovieRatingService(movieRatingRepo); //Creating variable what will return actual number of reviews int actual = movieRatingService.GetNumberOfReviewsFromReviewer(reviewerId); //Creating variable what will return expected number of reviews int expected = numberOfReviews; //Checking if expected and actual variables match Assert.Equal(expected, actual); }
public void GetNumberOfReviewsFromReviewer() { MovieRatingService mrs = new MovieRatingService(repository); mrs.GetNumberOfReviewsFromReviewer(reviewerMostReviews); }
public void GetNumberOfReviewsFromReviewer() { IMovieRatingService movieRatingService = new MovieRatingService(mRepo); CheckPerformance(() => movieRatingService.GetNumberOfReviewsFromReviewer(1), 4000); }