本文整理汇总了C#中IEncryptionService.EncryptText方法的典型用法代码示例。如果您正苦于以下问题:C# IEncryptionService.EncryptText方法的具体用法?C# IEncryptionService.EncryptText怎么用?C# IEncryptionService.EncryptText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEncryptionService
的用法示例。
在下文中一共展示了IEncryptionService.EncryptText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
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 protected]",
Email = "[email protected]",
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 protected]",
Email = "[email protected]",
PasswordFormat = PasswordFormat.Clear,
Password = "password",
Active = true
};
AddCustomerToRegisteredRole(customer2);
var customer3 = new Customer()
{
Username = "[email protected]",
Email = "[email protected]",
PasswordFormat = PasswordFormat.Encrypted,
Password = _encryptionService.EncryptText("password"),
Active = true
};
AddCustomerToRegisteredRole(customer3);
var customer4 = new Customer()
{
Username = "[email protected]",
Email = "[email protected]",
PasswordFormat = PasswordFormat.Clear,
Password = "password",
Active = true
};
AddCustomerToRegisteredRole(customer4);
var customer5 = new Customer()
{
Username = "[email protected]",
Email = "[email protected]",
PasswordFormat = PasswordFormat.Clear,
Password = "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>>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_newsLetterSubscriptionService = MockRepository.GenerateMock<INewsLetterSubscriptionService>();
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_customerService = new CustomerService(new NopNullCache(), _customerRepo, _customerRoleRepo,
_genericAttributeRepo, _genericAttributeService, _eventPublisher, _customerSettings);
_customerRegistrationService = new CustomerRegistrationService(_customerService,
_encryptionService, _newsLetterSubscriptionService, _localizationService,
_rewardPointsSettings, _customerSettings);
}