public void GetReviewsByBookID2Pages() { // Arrange var pageNumber = 1; int?pageSize = 5; int numberOfReviews = 10; int bookID = 1; var reviews = MockDataGenerator.CreateBookReviews(numberOfReviews); var envelope = MockDataGenerator.CreateBookReviewEnvelope(reviews, pageNumber, pageSize); var mockReviewRepo = new Mock <IReviewRepository>(); var mockMapper = new Mock <IMapper>(); mockReviewRepo.Setup(f => f.GetReviewsByBookID(bookID, pageNumber, pageSize)).Returns(envelope); var service = new ReviewService(mockReviewRepo.Object, mockMapper.Object); // Act var returnedReviews = service.GetReviewsByBookID(bookID, pageNumber, pageSize); // Assert mockReviewRepo.Verify(f => f.GetReviewsByBookID(bookID, pageNumber, pageSize), Times.Once()); Assert.IsNotNull(returnedReviews); Assert.AreEqual(returnedReviews.Paging.PageNumber, pageNumber); Assert.AreEqual(returnedReviews.Paging.PageMaxSize, pageSize); Assert.AreEqual(returnedReviews.Paging.PageCount, 2); Assert.AreEqual(returnedReviews.Paging.TotalNumberOfItems, numberOfReviews); Assert.AreEqual(returnedReviews.Items.First().User.ID, reviews.First().User.ID); }