public OrderController(OrderHistoryViewModelBuilder orderHistoryViewModelBuilder,
                        OrderViewModelBuilder orderViewModelBuilder,
                        OrderHistoryViewModelService orderHistoryViewModelService,
                        CartService cartService,
                        OrderConfirmationViewModelBuilder orderConfirmationViewModelBuilder)
 {
     _orderHistoryViewModelBuilder      = orderHistoryViewModelBuilder;
     _orderViewModelBuilder             = orderViewModelBuilder;
     _orderHistoryViewModelService      = orderHistoryViewModelService;
     _orderConfirmationViewModelBuilder = orderConfirmationViewModelBuilder;
     _cartService = cartService;
 }
Exemple #2
0
 public OrderController(
     OrderHistoryViewModelBuilder orderHistoryViewModelBuilder,
     OrderViewModelBuilder orderViewModelBuilder,
     OrderHistoryViewModelService orderHistoryViewModelService,
     OrderConfirmationViewModelBuilder orderConfirmationViewModelBuilder,
     ILogger <OrderController> logger)
 {
     _orderHistoryViewModelBuilder      = orderHistoryViewModelBuilder;
     _orderViewModelBuilder             = orderViewModelBuilder;
     _orderHistoryViewModelService      = orderHistoryViewModelService;
     _orderConfirmationViewModelBuilder = orderConfirmationViewModelBuilder;
     _logger = logger;
 }
        public void Build_ShouldReturnTheCorrectOrderNumberAndEmail()
        {
            //Arrange
            var orderNumber     = Tests.NUMBER_THAT_IS_ASSERTED_WITH_BUT_HAS_NO_MEANING;
            var checkoutDetails = new CheckoutDetailsModel()
            {
                Email = Tests.STRING_THAT_IS_ASSERTED_BUT_HAS_NO_MEANING
            };
            var builder = new OrderConfirmationViewModelBuilder(orderNumber, checkoutDetails);
            //Act
            var viewModel = builder.Build();

            //Assert
            viewModel.Email.Should().Be(Tests.STRING_THAT_IS_ASSERTED_BUT_HAS_NO_MEANING);
            viewModel.OrderNumber.Should().Be(orderNumber.ToString());
        }
Exemple #4
0
        public ActionResult OrderConfirmation(CheckoutDetailsModel checkoutDetailsModel)
        {
            if (CheckIfCartSessionTimedoutOrCartIsEmpty())
            {
                return(RedirectToAction("CheckoutSessionTimeout"));
            }

            var shoppingCart = shoppingCartWrapper.Get();

            var orderNumber = SaveOrderAndEmail(checkoutDetailsModel, shoppingCart);


            var builder   = new OrderConfirmationViewModelBuilder(orderNumber, checkoutDetailsModel);
            var viewModel = builder.Build();

            shoppingCartWrapper.Clear();

            return(View(viewModel));
        }