public void TestCancelCartWithoutToken()
        {
            var mockCartService = new Mock <ICartService>();
            var mockUserService = new Mock <IUserService>();

            mockCartService.Setup(x => x.CancelCart(cartRequest));
            var controller             = new CartController(mockCartService.Object, mockUserService.Object);
            IHttpActionResult response = controller.CancelCart();
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

            Assert.IsNotNull(contentResult.Content.Message);
        }
        public void TestCancelCartWithoutLogin()
        {
            var mockCartService = new Mock <ICartService>();
            var mockUserService = new Mock <IUserService>();

            mockCartService.Setup(x => x.CancelCart(cartRequest));
            var controller        = new CartController(mockCartService.Object, mockUserService.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.CancelCart();
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

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

            LoginContext.GetInstance().SaveContext(userContextDTO);
            var mockCartService = new Mock <ICartService>();
            var mockUserService = new Mock <IUserService>();

            mockCartService.Setup(x => x.CancelCart(cartRequest));
            var controller        = new CartController(mockCartService.Object, mockUserService.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.CancelCart();
            var contentResult          = response as OkNegotiatedContentResult <ControllerResponse>;

            Assert.IsTrue(contentResult.Content.Success);
        }