public Market(ICommandManager commandManager, IProductCart cartManager, ICartCouponCommandFactory couponCommandFactory) { _commandManager = commandManager ?? throw new ArgumentNullException(nameof(commandManager)); _couponCommandFactory = couponCommandFactory ?? throw new ArgumentNullException(nameof(couponCommandFactory)); ProductCart = cartManager ?? throw new ArgumentNullException(nameof(cartManager)); }
private static IMarket CreateTestMarket(IProductCart cart) { var marketCommandManager = new CommandManager(); var cartCouponCommands = new CartCouponCommandFactory(); var market = new Market(marketCommandManager, cart, cartCouponCommands); var cartCoupon = new DiscountCartCoupon(0.2M); market.SetCartCoupon(cartCoupon); return(market); }
private static void FillCart(IProductCart cart) { var candyProductInfo = new ProductPriceInfo(new Candy("Vanilla", 50, 10, 5)); candyProductInfo.SetQty(4); var productCoupon = new DiscountProductCoupon(0.25M, 3); candyProductInfo.SetProductCoupon(productCoupon); cart.AddProduct(candyProductInfo); var juiceProductInfo = new ProductPriceInfo(new Juice("Orange", 25, 50, "red")); juiceProductInfo.SetQty(2); cart.AddProduct(juiceProductInfo); }
public SetCouponToCartCommand(IProductCart cart, ICartCoupon cartCoupon) { _cart = cart; _newCoupon = cartCoupon; _previousCoupon = _cart.CartCoupon; }
public ICommand CreateSetCartCouponCommand(IProductCart cart, ICartCoupon cartCoupon) { return(new SetCouponToCartCommand(cart, cartCoupon)); }