public ProductBuilderTests()
        {
            this.variantBuilder    = Substitute.For <IVariantBuilder <Item> >();
            this.pricingManager    = Substitute.For <IPricingManager>();
            this.inventoryManager  = Substitute.For <IInventoryManager>();
            this.storefrontContext = Substitute.For <IStorefrontContext>();

            this.getProductBulkPricesResult = this.Fixture.Create <GetProductBulkPricesResult>();
            this.pricingManager
            .GetProductBulkPrices(Arg.Any <string>(), Arg.Any <IEnumerable <string> >(), Arg.Any <string[]>())
            .Returns(this.getProductBulkPricesResult);
            this.getProductPricesResult = this.Fixture.Create <GetProductPricesResult>();
            this.pricingManager
            .GetProductPrices(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <string[]>())
            .Returns(this.getProductPricesResult);
            this.Fixture.Customize <StockInformation>(
                info => info.With(i => i.Product, this.Fixture.Create <CommerceInventoryProduct>()));
            this.getStockInformationResult = this.Fixture.Create <GetStockInformationResult>();
            this.inventoryManager
            .GetStockInformation(
                Arg.Any <string>(),
                Arg.Any <IEnumerable <CommerceInventoryProduct> >(),
                Arg.Any <StockDetailsLevel>())
            .Returns(this.getStockInformationResult);

            this.productBuilder = new ProductBuilder(
                this.variantBuilder,
                this.CatalogContext,
                this.pricingManager,
                this.inventoryManager,
                this.storefrontContext,
                this.CatalogMapper);
        }
Beispiel #2
0
        public ProductBuilder(
            IVariantBuilder <Item> variantBuilder,
            ICatalogContext catalogContext,
            IPricingManager pricingManager,
            IInventoryManager inventoryManager,
            IStorefrontContext storefrontContext,
            ICatalogMapper catalogMapper) : base(
                catalogContext,
                catalogMapper)
        {
            Assert.ArgumentNotNull(variantBuilder, nameof(variantBuilder));
            Assert.ArgumentNotNull(inventoryManager, nameof(inventoryManager));
            Assert.ArgumentNotNull(pricingManager, nameof(pricingManager));
            Assert.ArgumentNotNull(storefrontContext, nameof(storefrontContext));

            this.variantBuilder    = variantBuilder;
            this.inventoryManager  = inventoryManager;
            this.pricingManager    = pricingManager;
            this.storefrontContext = storefrontContext;
        }