public void TestGetReviewsByProductIdWithoutToken()
        {
            var mockReviewService = new Mock <IReviewService>();

            mockReviewService.Setup(x => x.GetReviewsByProductId(reviewRequest.ProductId)).Returns(new List <ReviewDTO>());
            var cartService            = new Mock <ICartService>();
            var controller             = new ReviewController(mockReviewService.Object, cartService.Object);
            IHttpActionResult response = controller.GetReviewsByProductId(reviewRequest.ProductId);
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

            Assert.IsNotNull(contentResult.Content.Message);
        }
        public void TestGetReviewsByProductIdWithoutLogin()
        {
            var mockReviewService = new Mock <IReviewService>();

            mockReviewService.Setup(x => x.GetReviewsByProductId(reviewRequest.ProductId));
            var cartService       = new Mock <ICartService>();
            var controller        = new ReviewController(mockReviewService.Object, cartService.Object);
            var controllerContext = new HttpControllerContext();
            var request           = new HttpRequestMessage();

            request.Headers.Add(ControllerHelper.TOKEN_NAME, new Guid().ToString());
            controllerContext.Request    = request;
            controller.ControllerContext = controllerContext;
            IHttpActionResult response = controller.GetReviewsByProductId(reviewRequest.ProductId);
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

            Assert.IsNotNull(contentResult.Content.Message);
        }
        public void TestGetReviewsByProductIdWithLoginData()
        {
            string         token      = LoginContext.GetInstance().GenerateNewToken("1");
            UserContextDTO contextDTO = GetUserContextDTO(token);

            LoginContext.GetInstance().SaveContext(contextDTO);
            var mockReviewService = new Mock <IReviewService>();

            mockReviewService.Setup(x => x.GetReviewsByProductId(reviewRequest.ProductId)).Returns(new List <ReviewDTO>());
            var cartService       = new Mock <ICartService>();
            var controller        = new ReviewController(mockReviewService.Object, cartService.Object);
            var controllerContext = new HttpControllerContext();
            var request           = new HttpRequestMessage();

            request.Headers.Add(ControllerHelper.TOKEN_NAME, token);
            controllerContext.Request    = request;
            controller.ControllerContext = controllerContext;
            IHttpActionResult response = controller.GetReviewsByProductId(reviewRequest.ProductId);
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

            Assert.IsNotNull(contentResult.Content.Data);
        }