public new void SetUp()
        {
            _qeRepository         = MockRepository.GenerateMock <IRepository <QueuedEmail> >();
            _qeaRepository        = MockRepository.GenerateMock <IRepository <QueuedEmailAttachment> >();
            _emailSender          = MockRepository.GenerateMock <IEmailSender>();
            _services             = MockRepository.GenerateMock <ICommonServices>();
            _mediaService         = MockRepository.GenerateMock <IMediaService>();
            _mediaStorageProvider = ProviderManager.GetProvider <IMediaStorageProvider>(DatabaseMediaStorageProvider.SystemName);

            _settingService = new ConfigFileSettingService(null, null);
            _services.Expect(x => x.Settings).Return(_settingService);
            _services.Expect(x => x.MediaService).Return(_mediaService);

            _queuedEmailService = new QueuedEmailService(_qeRepository, _qeaRepository, _emailSender, _services);
        }
示例#2
0
        public new void SetUp()
        {
            _paymentSettings = new PaymentSettings();
            _paymentSettings.ActivePaymentMethodSystemNames = new List <string>();
            _paymentSettings.ActivePaymentMethodSystemNames.Add("Payments.TestMethod");

            _storeMappingRepository = MockRepository.GenerateMock <IRepository <StoreMapping> >();
            _storeMappingService    = MockRepository.GenerateMock <IStoreMappingService>();
            _cartRuleProvider       = MockRepository.GenerateMock <ICartRuleProvider>();

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.RequestCache).Return(NullRequestCache.Instance);

            var paymentMethods = new List <PaymentMethod> {
                new PaymentMethod {
                    PaymentMethodSystemName = "Payments.TestMethod"
                }
            };

            _paymentMethodRepository = MockRepository.GenerateMock <IRepository <PaymentMethod> >();
            _paymentMethodRepository.Expect(x => x.TableUntracked).Return(paymentMethods.AsQueryable());

            _typeFinder = MockRepository.GenerateMock <ITypeFinder>();
            _typeFinder.Expect(x => x.FindClassesOfType((Type)null, null, true)).IgnoreArguments().Return(Enumerable.Empty <Type>()).Repeat.Any();

            var localizationService = MockRepository.GenerateMock <ILocalizationService>();

            localizationService.Expect(ls => ls.GetResource(null)).IgnoreArguments().Return("NotSupported").Repeat.Any();

            _paymentService = new PaymentService(_paymentMethodRepository, _storeMappingRepository, _storeMappingService, _paymentSettings, _cartRuleProvider,
                                                 this.ProviderManager, _services, _typeFinder);
        }
示例#3
0
        public new void SetUp()
        {
            _store = new Store()
            {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            _discountService = MockRepository.GenerateMock <IDiscountService>();

            _categoryService = MockRepository.GenerateMock <ICategoryService>();

            _productAttributeParser  = MockRepository.GenerateMock <IProductAttributeParser>();
            _productService          = MockRepository.GenerateMock <IProductService>();
            _productAttributeService = MockRepository.GenerateMock <IProductAttributeService>();

            _downloadService = MockRepository.GenerateMock <IDownloadService>();
            _services        = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.StoreContext).Return(_storeContext);
            _httpRequestBase = MockRepository.GenerateMock <HttpRequestBase>();
            _taxService      = MockRepository.GenerateMock <ITaxService>();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            _priceCalcService = new PriceCalculationService(_discountService, _categoryService, _productAttributeParser, _productService, _shoppingCartSettings, _catalogSettings,
                                                            _productAttributeService, _downloadService, _services, _httpRequestBase, _taxService);
        }
        public virtual void Setup()
        {
            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.EventPublisher).Return(_eventPublisher);

            _productService              = MockRepository.GenerateMock <IProductService>();
            _productRepository           = MockRepository.GenerateMock <IRepository <Product> >();
            _localizedPropertyRepository = MockRepository.GenerateMock <IRepository <LocalizedProperty> >();
            _storeMappingRepository      = MockRepository.GenerateMock <IRepository <StoreMapping> >();
            _aclRepository       = MockRepository.GenerateMock <IRepository <AclRecord> >();
            _deliveryTimeService = MockRepository.GenerateMock <IDeliveryTimeService>();
            _manufacturerService = MockRepository.GenerateMock <IManufacturerService>();
            _categoryService     = MockRepository.GenerateMock <ICategoryService>();

            _linqCatalogSearchService = new LinqCatalogSearchService(
                _services,
                _productService,
                _productRepository,
                _localizedPropertyRepository,
                _storeMappingRepository,
                _aclRepository,
                _deliveryTimeService,
                _manufacturerService,
                _categoryService);
        }
        public new void SetUp()
        {
			_store = new Store() { Id = 1 };
			_storeContext = MockRepository.GenerateMock<IStoreContext>();
			_storeContext.Expect(x => x.CurrentStore).Return(_store);

            _discountService = MockRepository.GenerateMock<IDiscountService>();

            _categoryService = MockRepository.GenerateMock<ICategoryService>();

            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
			_productService = MockRepository.GenerateMock<IProductService>();
			_productAttributeService = MockRepository.GenerateMock<IProductAttributeService>();

			_downloadService = MockRepository.GenerateMock<IDownloadService>();
			_commonServices = MockRepository.GenerateMock<ICommonServices>();
			_commonServices.Expect(x => x.StoreContext).Return(_storeContext);
			_httpRequestBase = MockRepository.GenerateMock<HttpRequestBase>();
			_taxService = MockRepository.GenerateMock<ITaxService>();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings = new CatalogSettings();

			_priceCalcService = new PriceCalculationService(_discountService, _categoryService, _productAttributeParser, _productService, _shoppingCartSettings, _catalogSettings,
				_productAttributeService, _downloadService, _commonServices, _httpRequestBase, _taxService);
        }
        public new void SetUp()
        {
            _qeRepository       = MockRepository.GenerateMock <IRepository <QueuedEmail> >();
            _qeaRepository      = MockRepository.GenerateMock <IRepository <QueuedEmailAttachment> >();
            _downloadRepository = MockRepository.GenerateMock <IRepository <Download> >();
            _emailSender        = MockRepository.GenerateMock <IEmailSender>();
            _services           = MockRepository.GenerateMock <ICommonServices>();
            _eventPublisher     = MockRepository.GenerateMock <IEventPublisher>();

            _settingService = new ConfigFileSettingService(null, null);
            _services.Expect(x => x.Settings).Return(_settingService);

            _downloadService = new DownloadService(_downloadRepository, _eventPublisher, _settingService, ProviderManager);

            _queuedEmailService = new QueuedEmailService(_qeRepository, _qeaRepository, _emailSender, _services, _downloadService, ProviderManager);
        }
示例#7
0
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings()
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings()
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _customerRepo.Expect(x => x.Table).Return(new List <Customer>()
            {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo        = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo    = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _rewardPointsHistoryRepo = MockRepository.GenerateMock <IRepository <RewardPointsHistory> >();
            _userAgent = MockRepository.GenerateMock <IUserAgent>();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();

            _storeContext = MockRepository.GenerateMock <IStoreContext>();

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.StoreContext).Return(_storeContext);
            _services.Expect(x => x.RequestCache).Return(NullRequestCache.Instance);
            _services.Expect(x => x.Cache).Return(NullCache.Instance);
            _services.Expect(x => x.EventPublisher).Return(_eventPublisher);

            _messageModelProvider = MockRepository.GenerateMock <Lazy <IMessageModelProvider> >();

            _customerService = new CustomerService(_customerRepo, _customerRoleRepo,
                                                   _genericAttributeRepo, _rewardPointsHistoryRepo, _genericAttributeService, _rewardPointsSettings, _services, new FakeHttpContext("~/"), _userAgent, _messageModelProvider);

            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _rewardPointsSettings, _customerSettings, _storeContext, _eventPublisher);
        }
        public new void SetUp()
        {
            _settingService = MockRepository.GenerateMock <ISettingService>();
            _workContext    = MockRepository.GenerateMock <IWorkContext>();

            _store = new Store {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            _dateTimeSettings = new DateTimeSettings
            {
                AllowCustomersToSetTimeZone = false,
                DefaultStoreTimeZoneId      = ""
            };

            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            var customer1 = new Customer
            {
                Id         = 1,
                TimeZoneId = "Russian Standard Time"    // (GMT+03:00) Moscow, St. Petersburg, Volgograd
            };

            _customerRepo = MockRepository.GenerateMock <IRepository <Customer> >();
            _customerRepo.Expect(x => x.Table).Return(new List <Customer> {
                customer1
            }.AsQueryable());

            _customerRoleRepo        = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo    = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _rewardPointsHistoryRepo = MockRepository.GenerateMock <IRepository <RewardPointsHistory> >();
            _shoppingCartItemRepo    = MockRepository.GenerateMock <IRepository <ShoppingCartItem> >();
            _userAgent = MockRepository.GenerateMock <IUserAgent>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();
            _gdprTool = MockRepository.GenerateMock <Lazy <IGdprTool> >();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.StoreContext).Return(_storeContext);
            _services.Expect(x => x.RequestCache).Return(NullRequestCache.Instance);
            _services.Expect(x => x.Cache).Return(NullCache.Instance);
            _services.Expect(x => x.EventPublisher).Return(_eventPublisher);

            _customerService = new CustomerService(
                _customerRepo,
                _customerRoleRepo,
                _genericAttributeRepo,
                _rewardPointsHistoryRepo,
                _shoppingCartItemRepo,
                _genericAttributeService,
                _rewardPointsSettings,
                _services,
                new FakeHttpContext("~/"),
                _userAgent,
                new CustomerSettings(),
                _gdprTool);

            _dateTimeHelper = new DateTimeHelper(_workContext, _settingService, _dateTimeSettings, _customerService);
        }