/// <summary> /// Initializes a new instance of the <see cref="WishListManager" /> class. /// </summary> /// <param name="wishListServiceProvider">The wish list service provider.</param> /// <param name="accountManager">The account manager.</param> /// <param name="inventoryManager">The inventory manager.</param> public WishListManager([NotNull] WishListServiceProvider wishListServiceProvider, [NotNull] AccountManager accountManager, [NotNull] InventoryManager inventoryManager) { Assert.ArgumentNotNull(wishListServiceProvider, "wishListServiceProvider"); Assert.ArgumentNotNull(accountManager, "accountManager"); Assert.ArgumentNotNull(inventoryManager, "inventoryManager"); this.WishListServiceProvider = wishListServiceProvider; this.AccountManager = accountManager; this.InventoryManager = inventoryManager; }
/// <summary> /// Initializes a new instance of the <see cref="CartService" /> class. /// </summary> /// <param name="cartServiceProvider">The service provider.</param> /// <param name="wishListServiceProvider">The wish list service provider.</param> /// <param name="pricingServiceProvider">The pricing service provider.</param> /// <param name="shopName">Name of the shop.</param> /// <param name="contactFactory">The visitor factory.</param> /// <param name="inventoryServiceProvider">The inventory service provider.</param> /// <param name="customerServiceProvider">The customer service provider.</param> public CartService([NotNull] CartServiceProvider cartServiceProvider, [NotNull] WishListServiceProvider wishListServiceProvider, [NotNull] PricingServiceProvider pricingServiceProvider, [NotNull] string shopName, ContactFactory contactFactory, [NotNull] InventoryServiceProvider inventoryServiceProvider, [NotNull] CustomerServiceProvider customerServiceProvider) { Assert.ArgumentNotNull(cartServiceProvider, "cartServiceProvider"); Assert.ArgumentNotNull(wishListServiceProvider, "wishListServiceProvider"); Assert.ArgumentNotNull(pricingServiceProvider, "pricingServiceProvider"); Assert.ArgumentNotNull(customerServiceProvider, "customerServiceProvider"); Assert.ArgumentNotNullOrEmpty(shopName, "shopName"); this._cartServiceProvider = cartServiceProvider; this._pricingServiceProvider = pricingServiceProvider; this.shopName = shopName; this.contactFactory = contactFactory; this._inventoryServiceProvider = inventoryServiceProvider; this._customerServiceProvider = customerServiceProvider; this._wishListServiceProvider = wishListServiceProvider; }
/// <summary> /// Initializes a new instance of the <see cref="CartsServiceTest"/> class. /// </summary> public CartsServiceTest() { this.cart = new Cart(); this.cartFromAnonymous = new Cart(); this.result = new CartResult { Cart = this.cart }; this.resultFromAnonymous = new CartResult { Cart = this.cartFromAnonymous }; this.cartServiceProvider = Substitute.For <CartServiceProvider>(); this.cartServiceProvider.CreateOrResumeCart(Arg.Is <CreateOrResumeCartRequest>(r => r.UserId == "John Carter")).Returns(this.result); var pricesResult = new GetProductPricesResult(); pricesResult.Prices.Add("List", new Price(0, "USD")); this.pricingService = Substitute.For <PricingServiceProvider>(); this.pricingService.GetProductPrices(Arg.Any <GetProductPricesRequest>()).Returns(pricesResult); this.contactId = Guid.NewGuid(); this.cartServiceProvider.CreateOrResumeCart(Arg.Is <CreateOrResumeCartRequest>(r => r.UserId == ID.Parse(this.contactId).ToString())).Returns(this.resultFromAnonymous); this.cartServiceProvider.GetCarts(Arg.Any <GetCartsRequest>()).Returns(new GetCartsResult { Carts = Enumerable.Empty <CartBase>() }); this.contactFactory = Substitute.For <ContactFactory>(); this.contactFactory.GetContact().Returns("John Carter"); var inventoryResult = new GetStockInformationResult(); inventoryResult.StockInformation.ToList().Add(new StockInformation { Product = new InventoryProduct { ProductId = "1001" }, Status = StockStatus.InStock }); this._inventoryService = Substitute.For <InventoryServiceProvider>(); this._inventoryService.GetStockInformation(Arg.Any <GetStockInformationRequest>()).Returns(inventoryResult); this._customerService = Substitute.For <CustomerServiceProvider>(); this._wishListServiceProvider = Substitute.For <WishListServiceProvider>(); this.service = new CartService(this.cartServiceProvider, this._wishListServiceProvider, this.pricingService, "autohaus", this.contactFactory, this._inventoryService, this._customerService); }
public WishListManager(IWishListConnectServiceProvider connectServiceProvider) { Assert.ArgumentNotNull(connectServiceProvider, nameof(connectServiceProvider)); _wishListServiceProvider = connectServiceProvider.GetWishListServiceProvider(); }