Beispiel #1
0
        public void GetByUserWithNotFoundResponse()
        {
            facade.Setup(x => x.GetByUser(It.IsAny <UserRequest>())).Returns(new List <Review>());
            controller = new ReviewController(facade.Object);
            var result = controller.GetByUser(null);

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Beispiel #2
0
        public void GetByUserTest()
        {
            controller = new ReviewController(facade.Object);
            var result           = controller.GetByUser(null);
            var contentResult    = result as OkNegotiatedContentResult <List <Review> >;
            var listFromResponse = contentResult.Content;

            Assert.AreEqual(listFromResponse.First().Restaurant, review.Restaurant);
            Assert.AreEqual(listFromResponse.First().Comment, review.Comment);
            Assert.AreEqual(listFromResponse.First().RatingDateTime, review.RatingDateTime);
            Assert.AreEqual(listFromResponse.First().RestaurantId, review.RestaurantId);
            Assert.AreEqual(listFromResponse.First().ReviewId, review.ReviewId);
            Assert.AreEqual(listFromResponse.First().Score, review.Score);
            Assert.AreEqual(listFromResponse.First().User, review.User);
            Assert.AreEqual(listFromResponse.First().UserId, review.UserId);
        }