Esempio n. 1
0
        public void GetReviewById()
        {
            // Arrange
            var review = DataSeeder.Reviews.FirstOrDefault();

            Assert.IsNotNull(review, string.Format("No reviews were setup in the DataSeeder"));
            Mock.Get(_repositoryWrapper.Review).Setup(x => x.GetReviewById(review.Id)).ReturnsAsync(review);
            var controller = new ReviewController(_loggerManager, _mapper, _repositoryWrapper);
            // Act
            var actionResult = controller.GetReviewById(review.Id).Result;
            // Assert
            var okObjectResult = actionResult as OkObjectResult;

            Assert.IsNotNull(okObjectResult);
            var resultObject = okObjectResult.Value as Review;

            Assert.IsTrue(resultObject.Id == review.Id);
        }