本文整理汇总了C#中IStoreContext.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# IStoreContext.Expect方法的具体用法?C# IStoreContext.Expect怎么用?C# IStoreContext.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStoreContext
的用法示例。
在下文中一共展示了IStoreContext.Expect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public new void SetUp()
{
_workContext = null;
_store = new Store() { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
_discountService = MockRepository.GenerateMock<IDiscountService>();
_categoryService = MockRepository.GenerateMock<ICategoryService>();
_productService = MockRepository.GenerateMock<IProductService>();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_shoppingCartSettings = new ShoppingCartSettings();
_catalogSettings = new CatalogSettings();
_cacheManager = new NopNullCache();
_priceCalcService = new PriceCalculationService(_workContext,
_storeContext,
_discountService,
_categoryService,
_productAttributeParser,
_productService,
_cacheManager,
_shoppingCartSettings,
_catalogSettings);
}
示例2: SetUp
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);
}
示例3: SetUp
public new void SetUp()
{
_discountRepo = MockRepository.GenerateMock<IRepository<Discount>>();
var discount1 = new Discount
{
Id = 1,
DiscountType = DiscountType.AssignedToCategories,
Name = "Discount 1",
UsePercentage = true,
DiscountPercentage = 10,
DiscountAmount = 0,
DiscountLimitation = DiscountLimitationType.Unlimited,
LimitationTimes = 0,
};
var discount2 = new Discount
{
Id = 2,
DiscountType = DiscountType.AssignedToSkus,
Name = "Discount 2",
UsePercentage = false,
DiscountPercentage = 0,
DiscountAmount = 5,
RequiresCouponCode = true,
CouponCode = "SecretCode",
DiscountLimitation = DiscountLimitationType.NTimesPerCustomer,
LimitationTimes = 3,
};
_discountRepo.Expect(x => x.Table).Return(new List<Discount>() { discount1, discount2 }.AsQueryable());
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(new Store
{
Id = 1,
Name = "MyStore"
});
_settingService = MockRepository.GenerateMock<ISettingService>();
var cacheManager = new NullCache();
_discountRequirementRepo = MockRepository.GenerateMock<IRepository<DiscountRequirement>>();
_discountUsageHistoryRepo = MockRepository.GenerateMock<IRepository<DiscountUsageHistory>>();
var pluginFinder = new PluginFinder();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_discountService = new DiscountService(cacheManager, _discountRepo, _discountRequirementRepo,
_discountUsageHistoryRepo, _storeContext, _genericAttributeService, pluginFinder, _eventPublisher,
_settingService, base.ProviderManager);
}
示例4: SetUp
public new void SetUp()
{
_shippingSettings = new ShippingSettings();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
_shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
_deliveryDateRepository = MockRepository.GenerateMock<IRepository<DeliveryDate>>();
_warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>();
_logger = new NullLogger();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
var cacheManager = new NopNullCache();
var pluginFinder = new PluginFinder();
_productService = MockRepository.GenerateMock<IProductService>();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_addressService = MockRepository.GenerateMock<IAddressService>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_store = new Store { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
_shoppingCartSettings = new ShoppingCartSettings();
_shippingService = new ShippingService(_shippingMethodRepository,
_deliveryDateRepository,
_warehouseRepository,
_logger,
_productService,
_productAttributeParser,
_checkoutAttributeParser,
_genericAttributeService,
_localizationService,
_addressService,
_shippingSettings,
pluginFinder,
_storeContext,
_eventPublisher,
_shoppingCartSettings,
cacheManager);
}
示例5: SetUp
public new void SetUp()
{
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_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 = ""
};
_dateTimeHelper = new DateTimeHelper(_workContext, _genericAttributeService,
_settingService, _dateTimeSettings);
}
示例6: SetUp
public new void SetUp()
{
_workContext = MockRepository.GenerateMock<IWorkContext>();
_store = new Store() { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
var pluginFinder = new PluginFinder();
var cacheManager = new NopNullCache();
//price calculation service
_discountService = MockRepository.GenerateMock<IDiscountService>();
_categoryService = MockRepository.GenerateMock<ICategoryService>();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_shoppingCartSettings = new ShoppingCartSettings();
_catalogSettings = new CatalogSettings();
_priceCalcService = new PriceCalculationService(_workContext, _discountService,
_categoryService, _productAttributeParser, _shoppingCartSettings, _catalogSettings);
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
//shipping
_shippingSettings = new ShippingSettings();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
_shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
_logger = new NullLogger();
_shippingService = new ShippingService(cacheManager,
_shippingMethodRepository,
_logger,
_productAttributeParser,
_checkoutAttributeParser,
_genericAttributeService,
_localizationService,
_shippingSettings, pluginFinder,
_eventPublisher, _shoppingCartSettings);
_paymentService = MockRepository.GenerateMock<IPaymentService>();
_checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
_giftCardService = MockRepository.GenerateMock<IGiftCardService>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
//tax
_taxSettings = new TaxSettings();
_taxSettings.ShippingIsTaxable = true;
_taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
_taxSettings.DefaultTaxAddressId = 10;
_addressService = MockRepository.GenerateMock<IAddressService>();
_addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address() { Id = _taxSettings.DefaultTaxAddressId });
_taxService = new TaxService(_addressService, _workContext, _taxSettings, pluginFinder);
_rewardPointsSettings = new RewardPointsSettings();
_orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
_priceCalcService, _taxService, _shippingService, _paymentService,
_checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService,
_taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
}
示例7: SetUp
public new void SetUp()
{
_workContext = null;
_store = new Store() { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
var pluginFinder = new PluginFinder();
_shoppingCartSettings = new ShoppingCartSettings();
_catalogSettings = new CatalogSettings();
var cacheManager = new NopNullCache();
_productService = MockRepository.GenerateMock<IProductService>();
//price calculation service
_discountService = MockRepository.GenerateMock<IDiscountService>();
_categoryService = MockRepository.GenerateMock<ICategoryService>();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_priceCalcService = new PriceCalculationService(_workContext, _storeContext,
_discountService, _categoryService,
_productAttributeParser, _productService,
cacheManager, _shoppingCartSettings, _catalogSettings);
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
//shipping
_shippingSettings = new ShippingSettings();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
_shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
_deliveryDateRepository = MockRepository.GenerateMock<IRepository<DeliveryDate>>();
_warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>();
_logger = new NullLogger();
_shippingService = new ShippingService(_shippingMethodRepository,
_deliveryDateRepository,
_warehouseRepository,
_logger,
_productService,
_productAttributeParser,
_checkoutAttributeParser,
_genericAttributeService,
_localizationService,
_addressService,
_shippingSettings,
pluginFinder,
_storeContext,
_eventPublisher,
_shoppingCartSettings,
cacheManager);
_shipmentService = MockRepository.GenerateMock<IShipmentService>();
_paymentService = MockRepository.GenerateMock<IPaymentService>();
_checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
_giftCardService = MockRepository.GenerateMock<IGiftCardService>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
//tax
_taxSettings = new TaxSettings();
_taxSettings.ShippingIsTaxable = true;
_taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
_taxSettings.DefaultTaxAddressId = 10;
_addressService = MockRepository.GenerateMock<IAddressService>();
_addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address() { Id = _taxSettings.DefaultTaxAddressId });
_taxService = new TaxService(_addressService, _workContext, _taxSettings, pluginFinder);
_rewardPointsSettings = new RewardPointsSettings();
_orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
_priceCalcService, _taxService, _shippingService, _paymentService,
_checkoutAttributeParser, _discountService, _giftCardService,
_genericAttributeService,
_taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
_orderService = MockRepository.GenerateMock<IOrderService>();
_webHelper = MockRepository.GenerateMock<IWebHelper>();
_languageService = MockRepository.GenerateMock<ILanguageService>();
_priceFormatter= MockRepository.GenerateMock<IPriceFormatter>();
_productAttributeFormatter= MockRepository.GenerateMock<IProductAttributeFormatter>();
_shoppingCartService= MockRepository.GenerateMock<IShoppingCartService>();
_checkoutAttributeFormatter= MockRepository.GenerateMock<ICheckoutAttributeFormatter>();
_customerService= MockRepository.GenerateMock<ICustomerService>();
_encryptionService = MockRepository.GenerateMock<IEncryptionService>();
_workflowMessageService = MockRepository.GenerateMock<IWorkflowMessageService>();
_customerActivityService = MockRepository.GenerateMock<ICustomerActivityService>();
_currencyService = MockRepository.GenerateMock<ICurrencyService>();
_affiliateService = MockRepository.GenerateMock<IAffiliateService>();
_vendorService = MockRepository.GenerateMock<IVendorService>();
_pdfService = MockRepository.GenerateMock<IPdfService>();
_paymentSettings = new PaymentSettings()
{
ActivePaymentMethodSystemNames = new List<string>()
{
"Payments.TestMethod"
//.........这里部分代码省略.........
示例8: SetUp
public new void SetUp()
{
_workContext = MockRepository.GenerateMock<IWorkContext>();
_store = new Store { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
var pluginFinder = new PluginFinder();
_shoppingCartSettings = new ShoppingCartSettings();
_catalogSettings = new CatalogSettings();
//price calculation service
_discountService = MockRepository.GenerateMock<IDiscountService>();
_categoryService = MockRepository.GenerateMock<ICategoryService>();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_productService = MockRepository.GenerateMock<IProductService>();
_productAttributeService = MockRepository.GenerateMock<IProductAttributeService>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_settingService = MockRepository.GenerateMock<ISettingService>();
_typeFinder = MockRepository.GenerateMock<ITypeFinder>();
//shipping
_shippingSettings = new ShippingSettings();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
_shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
_logger = new NullLogger();
_shippingService = new ShippingService(
_shippingMethodRepository,
_logger,
_productAttributeParser,
_productService,
_checkoutAttributeParser,
_genericAttributeService,
_shippingSettings,
_eventPublisher,
_shoppingCartSettings,
_settingService,
this.ProviderManager,
_typeFinder);
_providerManager = MockRepository.GenerateMock<IProviderManager>();
_checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
_giftCardService = MockRepository.GenerateMock<IGiftCardService>();
//tax
_taxSettings = new TaxSettings();
_taxSettings.ShippingIsTaxable = true;
_taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
_taxSettings.PricesIncludeTax = false;
_taxSettings.TaxDisplayType = TaxDisplayType.IncludingTax;
_taxSettings.DefaultTaxAddressId = 10;
_addressService = MockRepository.GenerateMock<IAddressService>();
_addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address { Id = _taxSettings.DefaultTaxAddressId });
_downloadService = MockRepository.GenerateMock<IDownloadService>();
_services = MockRepository.GenerateMock<ICommonServices>();
_httpRequestBase = MockRepository.GenerateMock<HttpRequestBase>();
_geoCountryLookup = MockRepository.GenerateMock<IGeoCountryLookup>();
_taxService = new TaxService(_addressService, _workContext, _taxSettings, _shoppingCartSettings, pluginFinder, _geoCountryLookup, this.ProviderManager);
_rewardPointsSettings = new RewardPointsSettings();
_priceCalcService = new PriceCalculationService(_discountService, _categoryService, _productAttributeParser, _productService, _shoppingCartSettings, _catalogSettings,
_productAttributeService, _downloadService, _services, _httpRequestBase, _taxService);
_orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
_priceCalcService, _taxService, _shippingService, _providerManager,
_checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService, _productAttributeParser,
_taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
}
示例9: SetUp
public new void SetUp()
{
currencyUSD = new Currency()
{
Id = 1,
Name = "US Dollar",
CurrencyCode = "USD",
Rate = 1.2M,
DisplayLocale = "en-US",
CustomFormatting = "",
Published = true,
DisplayOrder = 1,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc = DateTime.UtcNow,
};
currencyEUR = new Currency()
{
Id = 2,
Name = "Euro",
CurrencyCode = "EUR",
Rate = 1,
DisplayLocale = "de-DE",
CustomFormatting = "€0.00",
Published = true,
DisplayOrder = 2,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc = DateTime.UtcNow,
};
currencyRUR = new Currency()
{
Id = 3,
Name = "Russian Rouble",
CurrencyCode = "RUB",
Rate = 34.5M,
DisplayLocale = "ru-RU",
CustomFormatting = "",
Published = true,
DisplayOrder = 3,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc = DateTime.UtcNow,
};
_currencyRepository = MockRepository.GenerateMock<IRepository<Currency>>();
_currencyRepository.Expect(x => x.Table).Return(new List<Currency>() { currencyUSD, currencyEUR, currencyRUR }.AsQueryable());
_currencyRepository.Expect(x => x.GetById(currencyUSD.Id)).Return(currencyUSD);
_currencyRepository.Expect(x => x.GetById(currencyEUR.Id)).Return(currencyEUR);
_currencyRepository.Expect(x => x.GetById(currencyRUR.Id)).Return(currencyRUR);
_storeMappingService = MockRepository.GenerateMock<IStoreMappingService>();
_storeContext = MockRepository.GenerateMock<IStoreContext>();
var cacheManager = new NullCache();
_currencySettings = new CurrencySettings();
_storeContext.Expect(x => x.CurrentStore).Return(new Store
{
Name = "Computer store",
Url = "http://www.yourStore.com",
Hosts = "yourStore.com,www.yourStore.com",
PrimaryStoreCurrency = currencyUSD,
PrimaryExchangeRateCurrency = currencyEUR
});
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
var pluginFinder = new PluginFinder();
_currencyService = new CurrencyService(cacheManager, _currencyRepository, _storeMappingService,
_currencySettings, pluginFinder, _eventPublisher, this.ProviderManager, _storeContext);
}