Esempio n. 1
0
        public void CheckPassword_UnsaltedPassword_False()
        {
            string          password = "******";
            IPasswordHasher subject  = new SimplePasswordHasher("userName");

            Assert.That(subject.CheckPassword(password, password), Is.False);
        }
Esempio n. 2
0
        public void CheckPassword_AnotherSaltedPassword_False()
        {
            string          password = "******";
            IPasswordHasher subject  = new SimplePasswordHasher("userName");
            string          hashed   = subject.HashPassword("anotherPassword");

            Assert.That(subject.CheckPassword(password, hashed), Is.False);
        }
Esempio n. 3
0
        public void CheckPassword_SameSaltedPassword_True()
        {
            string password = "******";

            IPasswordHasher subject = new SimplePasswordHasher("userName");
            string          hashed  = subject.HashPassword(password);

            Assert.That(subject.CheckPassword(password, hashed), Is.True);
        }
Esempio n. 4
0
        public void CheckPassword_DifferentUserPassword_False()
        {
            string password = "******";

            IPasswordHasher oneHasher = new SimplePasswordHasher("user1"),
                            twoHasher = new SimplePasswordHasher("user2");
            string hashedWithOne      = oneHasher.HashPassword(password);

            Assert.That(twoHasher.CheckPassword(password, hashedWithOne), Is.False);
        }