public async void MixedBag() { ShoppingCart cart = await _ctx.ShoppingCarts.GetShoppingCartAsync(String.Format("Xunit Test: {0}", DateTime.Now.Ticks)); await cart.AddProductByIdAsync(1); await cart.AddProductByIdAsync(2, 5); Assert.Equal(55.00M, cart.GetTotal()); }
public async void MixedBagWithPromotion() { ShoppingCart cart = await _ctx.ShoppingCarts.GetShoppingCartAsync(String.Format("Xunit Test: {0}", DateTime.Now.Ticks)); await cart.AddProductByIdAsync(1); await cart.AddProductByIdAsync(2, 5); await cart.AddCouponByCodeAsync("ORANGEUGR8"); Assert.Equal(30.00M, cart.GetTotal()); Assert.Equal(25.00M, cart.GetDiscountTotal()); }
public async Task <IActionResult> OnPostAsync(int productId, int quantity = 1) { ShoppingCart cart = await _starzApplicationService.GetShoppingCartAsync(); await cart.AddProductByIdAsync(productId, quantity); return(RedirectToPage("/Cart/Index")); }