Example #1
0
 public ActionResult MiniCartDetails()
 {
     var viewModel = new MiniCartViewModel
     {
         ItemCount = _cartService.GetLineItemsTotalQuantity(),
         CheckoutPage = _contentLoader.Get<StartPage>(ContentReference.StartPage).CheckoutPage,
         CartItems = _cartService.GetCartItems(),
         Total = _cartService.GetSubTotal()
     };
     
     return PartialView("_MiniCartDetails", viewModel);
 }
 public void MiniCartDetails_WhenCreatingViewModel_ShouldCreateModel()
 {
     var expectedResult = new MiniCartViewModel
     {
         ItemCount = 6,
         CheckoutPage = new ContentReference(444),
         CartItems = new List<CartItem>
         {
             new CartItem
             {
                 Code = "code",
                 DiscountPrice = new Money(45, Currency.USD),
                 DisplayName = "red",
                 ExtendedPrice = new Money(270, Currency.USD),
                 PlacedPrice = new Money(50, Currency.USD),
                 Url = "url",
                 Quantity = 6
             }
         },
         Total = new Money(270, Currency.USD)
     };
     var result = ((PartialViewResult)_subject.MiniCartDetails()).Model as MiniCartViewModel;
     result.ShouldBeEquivalentTo(expectedResult);
 }