public async Task WhenUserDoesNotExist_ItShouldReturnFalse() { var userManager = new Mock <IUserManager>(); var handler = new IsPasswordResetTokenValidQueryHandler(userManager.Object); userManager.Setup(v => v.FindByIdAsync(UserId)).ReturnsAsync(null); var result = await handler.HandleAsync(Query); Assert.IsFalse(result); }
public async Task WhenUserExistsAndTokenInvalid_ItShouldReturnFalse() { var userManager = new Mock <IUserManager>(); var handler = new IsPasswordResetTokenValidQueryHandler(userManager.Object); userManager.Setup(v => v.FindByIdAsync(UserId)).ReturnsAsync(User); userManager.Setup(v => v.ValidatePasswordResetTokenAsync(User, Token)).ReturnsAsync(false); var result = await handler.HandleAsync(Query); Assert.IsFalse(result); }