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()); }
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); }