Esempio n. 1
0
        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");
        }
Esempio n. 2
0
        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);
        }