public void ResetPasswordThrowsProperly() { var sut = new Member() { PasswordResetToken = "bar", PasswordResetTokenExpiration = DateTimeOffset.UtcNow.AddMinutes(-60) }; Assert.Throws<ApplicationException>(() => sut.ResetPassword("foo", "wrong"), "wrong token"); Assert.Throws<ApplicationException>(() => sut.ResetPassword("foo", "bar"), "old reset token"); }
public void ResetPasswordWorksProperly() { var sut = new Member() { PasswordResetToken = "bar", PasswordResetTokenExpiration = DateTimeOffset.UtcNow.AddMinutes(20) }; sut.ResetPassword("foo", "bar"); Assert.IsTrue(sut.VerifyPassword("foo")); Assert.IsNull(sut.PasswordResetToken); Assert.IsNull(sut.PasswordResetTokenExpiration); }