コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InventoryManager" /> class.
        /// </summary>
        /// <param name="inventoryServiceProvider">The inventory service provider.</param>
        /// <param name="contactFactory">The contact factory.</param>
        public InventoryManager([NotNull] InventoryServiceProvider inventoryServiceProvider, [NotNull] ContactFactory contactFactory)
        {
            Assert.ArgumentNotNull(inventoryServiceProvider, "inventoryServiceProvider");
            Assert.ArgumentNotNull(contactFactory, "contactFactory");

            this.InventoryServiceProvider = inventoryServiceProvider;
            this.ContactFactory = contactFactory;
            this._obecContext = (CommerceContextBase)Factory.CreateObject("commerceContext", true);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductController" /> class.
 /// </summary>
 /// <param name="productService">The product service.</param>
 /// <param name="pricingService">The price service.</param>
 /// <param name="contentSearchHelper">The content search helper.</param>
 /// <param name="inventoryService">The inventory service.</param>
 public ProductController([NotNull] IProductService productService, [NotNull] IPricingService pricingService, ContentSearchHelper contentSearchHelper, [NotNull] IInventoryService inventoryService, [NotNull] ICatalogService catalogService)
 {
     this.productService      = productService;
     this.pricingService      = pricingService;
     this.contentSearchHelper = contentSearchHelper;
     this._inventoryService   = inventoryService;
     this._catalogService     = catalogService;
     this._obecContext        = (CommerceContextBase)Factory.CreateObject(Constants.CommerceContext, true);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InventoryManager" /> class.
        /// </summary>
        /// <param name="inventoryServiceProvider">The inventory service provider.</param>
        /// <param name="contactFactory">The contact factory.</param>
        public InventoryManager([NotNull] InventoryServiceProvider inventoryServiceProvider, [NotNull] ContactFactory contactFactory)
        {
            Assert.ArgumentNotNull(inventoryServiceProvider, "inventoryServiceProvider");
            Assert.ArgumentNotNull(contactFactory, "contactFactory");

            this.InventoryServiceProvider = inventoryServiceProvider;
            this.ContactFactory           = contactFactory;
            this._obecContext             = (CommerceContextBase)Factory.CreateObject("commerceContext", true);
        }
コード例 #4
0
        public InventoryManager(InventoryServiceProvider inventoryServiceProvider, ContactFactory contactFactory, ICommerceSearchManager commerceSearchManager, StorefrontContext storefrontContext)
        {
            Assert.ArgumentNotNull(inventoryServiceProvider, nameof(inventoryServiceProvider));
            Assert.ArgumentNotNull(contactFactory, nameof(contactFactory));

            InventoryServiceProvider = inventoryServiceProvider;
            ContactFactory           = contactFactory;
            _obecContext             = (CommerceContextBase)Factory.CreateObject("commerceContext", true);
            CommerceSearchManager    = commerceSearchManager;
            StorefrontContext        = storefrontContext;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductControllerTest"/> class.
        /// </summary>
        public ProductControllerTest()
        {
            _context = new Glass.Sitecore.Mapper.Context();
            GlassMapperService.Current = Substitute.For <Glass.Sitecore.Mapper.ISitecoreService>();

            this.productService      = Substitute.For <IProductService>();
            this.pricingService      = Substitute.For <IPricingService>();
            this.contentSearchHelper = Substitute.For <ContentSearchHelper>();
            this._inventoryService   = Substitute.For <IInventoryService>();
            this._catalogService     = Substitute.For <ICatalogService>();
            this._obecContext        = Substitute.For <CommerceContextBase>();

            var httpContext = Substitute.For <HttpContextBase>();

            httpContext.Request.Url.Returns(new Uri("http://host/path"));
            httpContext.Request.QueryString.Returns(new NameValueCollection());

            this.controller = new ProductController(this.productService, this.pricingService, this.contentSearchHelper, this._inventoryService, this._catalogService);
            this.controller.ControllerContext = new ControllerContext(httpContext, new RouteData(), this.controller);
        }