本文整理汇总了C#中ILocalizationService.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# ILocalizationService.Expect方法的具体用法?C# ILocalizationService.Expect怎么用?C# ILocalizationService.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILocalizationService
的用法示例。
在下文中一共展示了ILocalizationService.Expect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public new void SetUp()
{
var cacheManager = new NopNullCache();
_workContext = null;
_currencySettings = new CurrencySettings();
var currency1 = new Currency
{
Id = 1,
Name = "Euro",
CurrencyCode = "EUR",
DisplayLocale = "",
CustomFormatting = "€0.00",
DisplayOrder = 1,
Published = true,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc= DateTime.UtcNow
};
var currency2 = new Currency
{
Id = 1,
Name = "US Dollar",
CurrencyCode = "USD",
DisplayLocale = "en-US",
CustomFormatting = "",
DisplayOrder = 2,
Published = true,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc= DateTime.UtcNow
};
_currencyRepo = MockRepository.GenerateMock<IRepository<Currency>>();
_currencyRepo.Expect(x => x.Table).Return(new List<Currency>() { currency1, currency2 }.AsQueryable());
_storeMappingService = MockRepository.GenerateMock<IStoreMappingService>();
var pluginFinder = new PluginFinder();
_currencyService = new CurrencyService(cacheManager, _currencyRepo, _storeMappingService,
_currencySettings, pluginFinder, null);
_taxSettings = new TaxSettings();
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_localizationService.Expect(x => x.GetResource("Products.InclTaxSuffix", 1, false)).Return("{0} incl tax");
_localizationService.Expect(x => x.GetResource("Products.ExclTaxSuffix", 1, false)).Return("{0} excl tax");
_priceFormatter = new PriceFormatter(_workContext, _currencyService,_localizationService,
_taxSettings, _currencySettings);
}
示例2: Setup
public void Setup()
{
//set up localziation service used by almost all validators
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_localizationService.Expect(l => l.GetResource("")).Return("Invalid").IgnoreArguments();
}
示例3: SetUp
public new void SetUp()
{
#region Test data
//color (dropdownlist)
pa1 = new ProductAttribute
{
Id = 1,
Name = "Color",
};
pva1_1 = new ProductVariantAttribute
{
Id = 11,
ProductVariantId = 1,
TextPrompt = "Select color:",
IsRequired = true,
AttributeControlType = AttributeControlType.DropdownList,
DisplayOrder = 1,
ProductAttribute = pa1,
ProductAttributeId = pa1.Id
};
pvav1_1 = new ProductVariantAttributeValue
{
Id = 11,
Name = "Green",
DisplayOrder = 1,
ProductVariantAttribute = pva1_1,
ProductVariantAttributeId = pva1_1.Id
};
pvav1_2 = new ProductVariantAttributeValue
{
Id = 12,
Name = "Red",
DisplayOrder = 2,
ProductVariantAttribute = pva1_1,
ProductVariantAttributeId = pva1_1.Id
};
pva1_1.ProductVariantAttributeValues.Add(pvav1_1);
pva1_1.ProductVariantAttributeValues.Add(pvav1_2);
//custom option (checkboxes)
pa2 = new ProductAttribute
{
Id = 2,
Name = "Some custom option",
};
pva2_1 = new ProductVariantAttribute
{
Id = 21,
ProductVariantId = 1,
TextPrompt = "Select at least one option:",
IsRequired = true,
AttributeControlType = AttributeControlType.Checkboxes,
DisplayOrder = 2,
ProductAttribute = pa2,
ProductAttributeId = pa2.Id
};
pvav2_1 = new ProductVariantAttributeValue
{
Id = 21,
Name = "Option 1",
DisplayOrder = 1,
ProductVariantAttribute = pva2_1,
ProductVariantAttributeId = pva2_1.Id
};
pvav2_2 = new ProductVariantAttributeValue
{
Id = 22,
Name = "Option 2",
DisplayOrder = 2,
ProductVariantAttribute = pva2_1,
ProductVariantAttributeId = pva2_1.Id
};
pva2_1.ProductVariantAttributeValues.Add(pvav2_1);
pva2_1.ProductVariantAttributeValues.Add(pvav2_2);
//custom text
pa3 = new ProductAttribute
{
Id = 3,
Name = "Custom text",
};
pva3_1 = new ProductVariantAttribute
{
Id = 31,
ProductVariantId = 1,
TextPrompt = "Enter custom text:",
IsRequired = true,
AttributeControlType = AttributeControlType.TextBox,
DisplayOrder = 1,
ProductAttribute = pa1,
ProductAttributeId = pa3.Id
};
#endregion
_productAttributeRepo = MockRepository.GenerateMock<IRepository<ProductAttribute>>();
_productAttributeRepo.Expect(x => x.Table).Return(new List<ProductAttribute>() { pa1, pa2, pa3 }.AsQueryable());
_productAttributeRepo.Expect(x => x.GetById(pa1.Id)).Return(pa1);
_productAttributeRepo.Expect(x => x.GetById(pa2.Id)).Return(pa2);
//.........这里部分代码省略.........