public ProductCardController(ICatalogContext catalogContext, IIndex <Product> productIndex,
                              IUrlService urlService)
 {
     _catalogContext = catalogContext;
     _productIndex   = productIndex;
     _urlService     = urlService;
 }
Exemplo n.º 2
0
 public ProductPriceController(ICatalogContext catalogContext, IIndex <Product> productIndex,
                               IProductPriceCalculationService productPriceCalculationService)
 {
     _catalogContext = catalogContext;
     _productIndex   = productIndex;
     _productPriceCalculationService = productPriceCalculationService;
 }
 public BasketController(ITransactionLibrary transactionLibrary, IMiniBasketService miniBasketService, IUrlService urlService, ICatalogContext catalogContext, ICatalogLibrary catalogLibrary)
 {
     _transactionLibrary = transactionLibrary;
     _miniBasketService  = miniBasketService;
     _urlService         = urlService;
     _catalogContext     = catalogContext;
     _catalogLibrary     = catalogLibrary;
 }
Exemplo n.º 4
0
        public CatalogService(ICatalogContext catalogContext, CatalogContext seedContext, IMapper mapper)
        {
            _catalogContext = catalogContext;
            _mapper         = mapper;

            // Only for seeding.
            CatalogDbInitializer.Initialize(seedContext);
        }
        public CatalogObject(ICatalogContext context)
        {
            Context = context;

            Queries = new CatalogObjectQueriesObject(this);

            Commands = new CatalogObjectCommandObject(this);
        }
Exemplo n.º 6
0
        public BaseRepository(ICatalogContext catalogContext)
        {
            if (catalogContext == null)
            {
                throw new ArgumentNullException(nameof(catalogContext));
            }

            this.collection = catalogContext.GetCollection <T>(typeof(T).Name);
        }
 public ReviewFormController(ICatalogContext catalogContext, IRepository <Product> productRepository, IRepository <ProductReviewStatus> productReviewStatusRepository,
                             IOrderContext orderContext, IPipeline <ProductReview> productReviewPipeline)
 {
     _catalogContext                = catalogContext;
     _productRepository             = productRepository;
     _productReviewStatusRepository = productReviewStatusRepository;
     _orderContext          = orderContext;
     _productReviewPipeline = productReviewPipeline;
 }
        public BaseProductBuilderTests()
        {
            this.CatalogContext = Substitute.For <ICatalogContext>();
            this.CatalogMapper  = Substitute.For <ICatalogMapper>();

            this.Fixture = new Fixture().Customize(new AutoDbCustomization());

            this.CatalogContext.CatalogName.Returns(this.Fixture.Create <string>());
        }
Exemplo n.º 9
0
        protected BaseProductBuilder(
            ICatalogContext catalogContext,
            ICatalogMapper catalogMapper)
        {
            Assert.ArgumentNotNull(catalogContext, nameof(catalogContext));
            Assert.ArgumentNotNull(catalogMapper, nameof(catalogMapper));

            this.CatalogContext = catalogContext;
            this.CatalogMapper  = catalogMapper;
        }
Exemplo n.º 10
0
        public VariantPickerControllerTests()
        {
            _getProductPipeline     = Substitute.For <IPipeline <IPipelineArgs <GetProductRequest, GetProductResponse> > >();
            _catalogContext         = Substitute.For <ICatalogContext>();
            _catalogLibraryInternal = Substitute.For <CatalogLibraryInternal>(null, null, null, null, null, null, null, null, null, null, null);

            _controller = new VariantPickerController(_getProductPipeline, _catalogContext, _catalogLibraryInternal);

            _controller.Url = Substitute.For <UrlHelper>();
            _controller.Url.Action(Arg.Any <string>()).Returns("ControllerUrl");
        }
        public AddToBasketControllerTests()
        {
            //Create
            _transactionLibraryInternal = Substitute.For <TransactionLibraryInternal>(null, null, null, null, null, null, null, null, null, null, null);
            _catalogContext             = Substitute.For <ICatalogContext>();
            _miniBasketService          = Substitute.For <MiniBasketService>(_transactionLibraryInternal);

            _controller = new AddToBasketButtonController(_transactionLibraryInternal, _catalogContext, _miniBasketService);

            _controller.Url = Substitute.For <UrlHelper>();
            _controller.Url.Action(Arg.Any <string>()).Returns("anything");
        }
        public BasketControllerTests()
        {
            // Create
            _transactionLibraryInternal = Substitute.For <ITransactionLibrary>();
            _miniBasketService          = Substitute.For <MiniBasketService>(_transactionLibraryInternal);
            _urlService     = Substitute.For <IUrlService>();
            _catalogContext = Substitute.For <ICatalogContext>();
            _catalogLibrary = Substitute.For <ICatalogLibrary>();

            _controller = new BasketController(_transactionLibraryInternal, _miniBasketService, _urlService, _catalogContext, _catalogLibrary);

            _controller.Url = Substitute.For <UrlHelper>();
            _controller.Url.Action(Arg.Any <string>()).Returns("anything");
        }
Exemplo n.º 13
0
 public VariantPickerController(
     IPipeline <IPipelineArgs <GetProductRequest,
                               GetProductResponse> > getProductPipeline,
     ICatalogContext catalogContext,
     ICatalogLibrary catalogLibrary,
     IIndex <Product> productIndex,
     ILocalizationContext localizationContext)
 {
     _getProductPipeline  = getProductPipeline;
     _catalogContext      = catalogContext;
     _catalogLibrary      = catalogLibrary;
     _productIndex        = productIndex;
     _localizationContext = localizationContext;
 }
Exemplo n.º 14
0
        public VariantPickerControllerTests()
        {
            _getProductPipeline = Substitute.For <IPipeline <IPipelineArgs <GetProductRequest, GetProductResponse> > >();
            _catalogContext     = Substitute.For <ICatalogContext>();
            _catalogLibrary     = Substitute.For <ICatalogLibrary>();
            _productIndex       = Substitute.For <IIndex <Product> >();
            // _productIndex.Definition.Returns(new AvenueProductIndexDefinition());
            _localizationContext = Substitute.For <ILocalizationContext>();
            _localizationContext.CurrentCulture.Returns(CultureInfo.GetCultureInfo("en-US"));

            _controller = new VariantPickerController(_getProductPipeline, _catalogContext, _catalogLibrary, _productIndex, _localizationContext);

            _controller.Url = Substitute.For <UrlHelper>();
            _controller.Url.Action(Arg.Any <string>()).Returns("ControllerUrl");
        }
Exemplo n.º 15
0
        public CreateCatalogItemValidator(ICatalogContext catalogContext)
        {
            _catalogContext = catalogContext;

            RuleFor(p => p.Name)
            .NotEmpty().WithMessage("{PropertyName} is required.")
            .NotNull()
            .MaximumLength(50).WithMessage("{PropertyName} must not exceed 50 characters.")
            .MustAsync(IsUniqueName).WithMessage("{PropertyName} already exists.");
            RuleFor(p => p.Description)
            .NotEmpty().WithMessage("{PropertyName} is required.")
            .NotNull();
            RuleFor(p => p.CatalogBrandId)
            .NotNull()
            .MustAsync(BrandExists).WithMessage("{PropertyName} does not exist.");
            RuleFor(p => p.CatalogTypeId)
            .NotNull()
            .MustAsync(TypeExists).WithMessage("{PropertyName} does not exist.");
        }
Exemplo n.º 16
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;
        }