Can_Generate_Password_Retrieve_Token_That_Expires_In_1_Minute_And_Reset_Password_After_Time_Limit_Expected_Fail () { var variableToken = DateTime.Now.ToLongTimeString(); var username = "******" + variableToken; const string email = "*****@*****.**"; const string woFs = "myTwoFactorSecret"; const string pwd = "password"; _uow = new SimpleMembershipUnitOfWorkAsync(_dataContextAsync, _loggingService); _simpleMembershipService = new WebSecurity(_uow, _loggingService); if (!_simpleMembershipService.FoundUser(username)) { var token = _simpleMembershipService.CreateUserAndAccount(username, pwd, email, true); CreatedTestUsers.Add(username); Assert.IsNotNull(token, "Token for selected username: [ " + username + " ] was *null*. "); } var actualToken = _simpleMembershipService.GetConfirmationToken(username); Assert.IsNotNull(actualToken, "Confirmation token for selected username: [ " + username + " ] was *null*. "); var isConfirmed = _simpleMembershipService.ConfirmAccount(actualToken); Assert.IsTrue(isConfirmed, "The requested users acount: [ " + username + " ] could *not* be confirmed. "); // We expect the account to already be confirmed at this point... var passwordResetToken = _simpleMembershipService.GeneratePasswordResetToken(username, 1); Assert.IsTrue(passwordResetToken.Length > 1, "Password reset token was *not* generated. "); Thread.Sleep(65000); // Minute and a half... // We expect the password reset to fail due to the timeout period expiry... var passwordWasReset = _simpleMembershipService.ResetPassword(passwordResetToken, "newPassword"); Assert.IsFalse(passwordWasReset, "Password should *not* have been reset - due to timeout. "); }