本文整理汇总了C#中UserRepository.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.Refresh方法的具体用法?C# UserRepository.Refresh怎么用?C# UserRepository.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository.Refresh方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActivateAccountTest
public void ActivateAccountTest()
{
IUserService accountSrv = new UserService();
UserAppService target = new UserAppService(accountSrv);
using (UserRepository repository = new UserRepository())
{
Guid accountId = new Guid("D1111C18-A0BD-480B-99CA-AAF50B2D1818");
var account = repository.Get(accountId);
string activationCode = account.ActivationCode;
target.ActivateAccount(accountId, activationCode);
repository.Refresh(account);
Assert.AreEqual(account.IsActive, true);
}
}
示例2: RechargeTest
public void RechargeTest()
{
IUserService accountSrv = new UserService();
UserAppService target = new UserAppService(accountSrv);
UserRepository accountRepository = new UserRepository();
int original = 0;
Guid accountId = new Guid("D1111C18-A0BD-480B-99CA-AAF50B2D1818");
var account = accountRepository.Get(accountId);
original = account.Coins;
int coins = 10;
target.Recharge(account.Id, coins);
accountRepository.Refresh(account);
Assert.AreEqual(original + coins, account.Coins);
}
示例3: ResetPasswordTest
public void ResetPasswordTest()
{
IUserService accountSrv = new UserService();
UserAppService target = new UserAppService(accountSrv);
Guid accountId = new Guid("D1111C18-A0BD-480B-99CA-AAF50B2D1818");
UserRepository accountRepository = new UserRepository();
var account = accountRepository.Get(accountId);
var password = account.Password;
target.ResetPassword(accountId, "[email protected]");
accountRepository.Refresh(account);
Assert.AreNotEqual(account.Password, password);
}
示例4: ChangePasswordTest
public void ChangePasswordTest()
{
IUserService accountSrv = new UserService();
UserRepository accountRepository = new UserRepository();
UserAppService target = new UserAppService(accountSrv);
Guid accountId = new Guid("D1111C18-A0BD-480B-99CA-AAF50B2D1818");
var account = accountRepository.Get(accountId);
string password = "abc123";
target.ChangePassword(accountId, "123456", password);
accountRepository.Refresh(account);
Assert.AreEqual(account.Password, DataCryptography.EncryptString(password));
}