public async Task ConfirmEmailSuccess_Test() { var mockUser = this.GetMockUserData(); IUserService _userService = MockConfirmEmail(mockUser); var exception = await Record.ExceptionAsync(() => _userService.ConfirmEmail(mockUser.Id, _ticTacToeHelper.GenerateTokenAsync(mockUser, GetMockSecurityKey()))); Assert.Null(exception); }
public async Task <UserDTO> CreateLoginToken(UserDTO user, SecurityKey securityKey) { var result = await _signinManager.PasswordSignInAsync(user.Email, user.Password, isPersistent : false, lockoutOnFailure : false); if (!result.Succeeded) { throw new UserLoginException(); } var identityUser = await _userManager.FindByEmailAsync(user.Email); return(new UserDTO { Id = identityUser.Id, LoginToken = _ticTacToeHelper.GenerateTokenAsync(identityUser, securityKey) }); }