private async Task <string> GenerateResetPasswordLink(ApplicationUser user, string path) { var token = await _userManager.GeneratePasswordResetTokenAsync(user); var link = ResetPasswordLinkGenerator.Generate(user.UserName, token, _settings.IdentityUrl, path); return(link); }
public void ResetPassword_generator_should_create_correct_link() { var fakeUser = "******"; var fakeToken = "123T65!adfr"; var fakeBaseUrl = "http://myhost:5000"; var fakePath = "/reset"; var expectedResult = string.Format("http://myhost:5000/reset?token={0}&username={1}", fakeToken, fakeUser); var link = ResetPasswordLinkGenerator.Generate(fakeUser, fakeToken, fakeBaseUrl, fakePath); link.Should().Be(expectedResult); }