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); } }
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); }
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, "*****@*****.**"); accountRepository.Refresh(account); Assert.AreNotEqual(account.Password, password); }
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 = "******"; target.ChangePassword(accountId, "123456", password); accountRepository.Refresh(account); Assert.AreEqual(account.Password, DataCryptography.EncryptString(password)); }