Ejemplo n.º 1
0
 public CustomMessageTokenProvider(CatalogSettings catalogSettings,
                                   CurrencySettings currencySettings,
                                   IActionContextAccessor actionContextAccessor,
                                   IAddressAttributeFormatter addressAttributeFormatter,
                                   ICurrencyService currencyService,
                                   ICustomerAttributeFormatter customerAttributeFormatter,
                                   ICustomerService customerService,
                                   IDateTimeHelper dateTimeHelper,
                                   IDownloadService downloadService,
                                   IEventPublisher eventPublisher,
                                   IGenericAttributeService genericAttributeService,
                                   ILanguageService languageService,
                                   ILocalizationService localizationService,
                                   IOrderService orderService,
                                   IPaymentService paymentService,
                                   IPriceFormatter priceFormatter,
                                   IStoreContext storeContext,
                                   IStoreService storeService,
                                   IUrlHelperFactory urlHelperFactory,
                                   IUrlRecordService urlRecordService,
                                   IVendorAttributeFormatter vendorAttributeFormatter,
                                   IWorkContext workContext,
                                   MessageTemplatesSettings templatesSettings,
                                   PaymentSettings paymentSettings,
                                   StoreInformationSettings storeInformationSettings,
                                   TaxSettings taxSettings) : base(catalogSettings,
                                                                   currencySettings,
                                                                   actionContextAccessor,
                                                                   addressAttributeFormatter,
                                                                   currencyService,
                                                                   customerAttributeFormatter,
                                                                   customerService,
                                                                   dateTimeHelper,
                                                                   downloadService,
                                                                   eventPublisher,
                                                                   genericAttributeService,
                                                                   languageService,
                                                                   localizationService,
                                                                   orderService,
                                                                   paymentService,
                                                                   priceFormatter,
                                                                   storeContext,
                                                                   storeService,
                                                                   urlHelperFactory,
                                                                   urlRecordService,
                                                                   vendorAttributeFormatter,
                                                                   workContext,
                                                                   templatesSettings,
                                                                   paymentSettings,
                                                                   storeInformationSettings,
                                                                   taxSettings
                                                                   )
 {
     this._catalogSettings            = catalogSettings;
     this._currencySettings           = currencySettings;
     this._actionContextAccessor      = actionContextAccessor;
     this._addressAttributeFormatter  = addressAttributeFormatter;
     this._currencyService            = currencyService;
     this._customerAttributeFormatter = customerAttributeFormatter;
     this._customerService            = customerService;
     this._dateTimeHelper             = dateTimeHelper;
     this._downloadService            = downloadService;
     this._eventPublisher             = eventPublisher;
     this._genericAttributeService    = genericAttributeService;
     this._languageService            = languageService;
     this._localizationService        = localizationService;
     this._orderService             = orderService;
     this._paymentService           = paymentService;
     this._priceFormatter           = priceFormatter;
     this._storeContext             = storeContext;
     this._storeService             = storeService;
     this._urlHelperFactory         = urlHelperFactory;
     this._urlRecordService         = urlRecordService;
     this._vendorAttributeFormatter = vendorAttributeFormatter;
     this._workContext              = workContext;
     this._templatesSettings        = templatesSettings;
     this._paymentSettings          = paymentSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._taxSettings              = taxSettings;
 }
        public new void SetUp()
        {
            _pictureService                = MockRepository.GenerateMock <IPictureService>();
            _authenticationService         = MockRepository.GenerateMock <IAuthenticationService>();
            _localizationService           = MockRepository.GenerateMock <ILocalizationService>();
            _workContext                   = MockRepository.GenerateMock <IWorkContext>();
            _vendorService                 = MockRepository.GenerateMock <IVendorService>();
            _productTemplateService        = MockRepository.GenerateMock <IProductTemplateService>();
            _dateRangeService              = MockRepository.GenerateMock <IDateRangeService>();
            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _storeService                  = MockRepository.GenerateMock <IStoreService>();
            _productAttributeService       = MockRepository.GenerateMock <IProductAttributeService>();
            _taxCategoryService            = MockRepository.GenerateMock <ITaxCategoryService>();
            _measureService                = MockRepository.GenerateMock <IMeasureService>();
            _catalogSettings               = new CatalogSettings();
            _specificationAttributeService = MockRepository.GenerateMock <ISpecificationAttributeService>();
            _orderSettings                 = new OrderSettings();
            _categoryService               = MockRepository.GenerateMock <ICategoryService>();
            _manufacturerService           = MockRepository.GenerateMock <IManufacturerService>();
            _customerService               = MockRepository.GenerateMock <ICustomerService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _productEditorSettings         = new ProductEditorSettings();
            _customerAttributeFormatter    = MockRepository.GenerateMock <ICustomerAttributeFormatter>();

            var httpContextAccessor = MockRepository.GenerateMock <IHttpContextAccessor>();
            var nopEngine           = MockRepository.GenerateMock <NopEngine>();
            var serviceProvider     = MockRepository.GenerateMock <IServiceProvider>();
            var urlRecordService    = MockRepository.GenerateMock <IUrlRecordService>();
            var picture             = new Picture
            {
                Id          = 1,
                SeoFilename = "picture"
            };

            _genericAttributeService.Expect(p => p.GetAttributesForEntity(1, "Customer"))
            .Return(new List <GenericAttribute>
            {
                new GenericAttribute
                {
                    EntityId = 1,
                    Key      = "manufacturer-advanced-mode",
                    KeyGroup = "Customer",
                    StoreId  = 0,
                    Value    = "true"
                }
            });
            _authenticationService.Expect(p => p.GetAuthenticatedCustomer()).Return(GetTestCustomer());
            _pictureService.Expect(p => p.GetPictureById(1)).Return(picture);
            _pictureService.Expect(p => p.GetThumbLocalPath(picture)).Return(@"c:\temp\picture.png");
            _pictureService.Expect(p => p.GetPicturesByProductId(1, 3)).Return(new List <Picture> {
                picture
            });
            _productTemplateService.Expect(p => p.GetAllProductTemplates()).Return(new List <ProductTemplate> {
                new ProductTemplate {
                    Id = 1
                }
            });
            _dateRangeService.Expect(d => d.GetAllDeliveryDates()).Return(new List <DeliveryDate> {
                new DeliveryDate {
                    Id = 1
                }
            });
            _dateRangeService.Expect(d => d.GetAllProductAvailabilityRanges()).Return(new List <ProductAvailabilityRange> {
                new ProductAvailabilityRange {
                    Id = 1
                }
            });
            _taxCategoryService.Expect(t => t.GetAllTaxCategories()).Return(new List <TaxCategory> {
                new TaxCategory()
            });
            _vendorService.Expect(v => v.GetAllVendors(showHidden: true)).Return(new PagedList <Vendor>(new List <Vendor> {
                new Vendor {
                    Id = 1
                }
            }, 0, 10));
            _measureService.Expect(m => m.GetAllMeasureWeights()).Return(new List <MeasureWeight> {
                new MeasureWeight()
            });
            _categoryService.Expect(c => c.GetProductCategoriesByProductId(1, true)).Return(new List <ProductCategory>());
            _manufacturerService.Expect(m => m.GetProductManufacturersByProductId(1, true)).Return(new List <ProductManufacturer>());

            nopEngine.Expect(x => x.ServiceProvider).Return(serviceProvider);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IGenericAttributeService))).Return(_genericAttributeService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IUrlRecordService))).Return(urlRecordService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(ILocalizationService))).Return(_localizationService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IWorkContext))).Return(_workContext);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IHttpContextAccessor))).Return(httpContextAccessor);

            EngineContext.Replace(nopEngine);
            _exportManager = new ExportManager(_categoryService, _manufacturerService, _customerService, _productAttributeService, _pictureService, _newsLetterSubscriptionService, _storeService, _workContext, _productEditorSettings, _vendorService, _productTemplateService, _dateRangeService, _taxCategoryService, _measureService, _catalogSettings, _genericAttributeService, _customerAttributeFormatter, _orderSettings, _specificationAttributeService, _localizedEntityService);
        }
 public CustomTokenProvider(
     ILanguageService languageService,
     ILocalizationService localizationService,
     IDateTimeHelper dateTimeHelper,
     IPriceFormatter priceFormatter,
     ICurrencyService currencyService,
     IWorkContext workContext,
     IDownloadService downloadService,
     IOrderService orderService,
     IPaymentService paymentService,
     IStoreService storeService,
     IStoreContext storeContext,
     IProductAttributeParser productAttributeParser,
     IAddressAttributeFormatter addressAttributeFormatter,
     ICustomerAttributeFormatter customerAttributeFormatter,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccessor,
     MessageTemplatesSettings templatesSettings,
     CatalogSettings catalogSettings,
     TaxSettings taxSettings,
     CurrencySettings currencySettings,
     ShippingSettings shippingSettings,
     PaymentSettings paymentSettings,
     IEventPublisher eventPublisher,
     StoreInformationSettings storeInformationSettings,
     IPluginFinder pluginFinder)
     :
     base(languageService,
          localizationService,
          dateTimeHelper,
          priceFormatter,
          currencyService,
          workContext,
          downloadService,
          orderService,
          paymentService,
          storeService,
          storeContext,
          productAttributeParser,
          addressAttributeFormatter,
          customerAttributeFormatter,
          urlHelperFactory,
          actionContextAccessor,
          templatesSettings,
          catalogSettings,
          taxSettings,
          currencySettings,
          shippingSettings,
          paymentSettings,
          eventPublisher,
          storeInformationSettings)
 {
     this._languageService            = languageService;
     this._localizationService        = localizationService;
     this._dateTimeHelper             = dateTimeHelper;
     this._priceFormatter             = priceFormatter;
     this._currencyService            = currencyService;
     this._workContext                = workContext;
     this._downloadService            = downloadService;
     this._orderService               = orderService;
     this._paymentService             = paymentService;
     this._productAttributeParser     = productAttributeParser;
     this._addressAttributeFormatter  = addressAttributeFormatter;
     this._customerAttributeFormatter = customerAttributeFormatter;
     this._storeService               = storeService;
     this._storeContext               = storeContext;
     this._templatesSettings          = templatesSettings;
     this._catalogSettings            = catalogSettings;
     this._taxSettings                = taxSettings;
     this._currencySettings           = currencySettings;
     this._shippingSettings           = shippingSettings;
     this._paymentSettings            = paymentSettings;
     this._eventPublisher             = eventPublisher;
     this._storeInformationSettings   = storeInformationSettings;
     this._pluginFinder               = pluginFinder;
 }