コード例 #1
0
        public SellableItem Build()
        {
            var sellableItem = new SellableItem
            {
                Id                  = "Entity-SellableItem-" + id,
                FriendlyId          = id,
                ProductId           = id,
                Name                = name,
                DisplayName         = name,
                ListPrice           = new Money(price),
                ParentCategoryList  = "001",
                CatalogToEntityList = "Entity-Catalog-" + catalog
            };

            sellableItem.AddComponents(new CatalogsComponent
            {
                ChildComponents = new[]
                {
                    new CatalogComponent
                    {
                        Name = catalog
                    }
                }
            });

            sellableItem.AddPolicies(new ListPricingPolicy(new[] { new Money(price) }), new AvailabilityAlwaysPolicy());

            return(sellableItem);
        }