Beispiel #1
0
        public void EncryptPasswordTwiceAndCompareTest_EncryptsAPasswordTwiceAndThenComparesBothToBeTheSame_FailsIfNotEqual()
        {
            PasswordEncryptionService passwordEncryption = new PasswordEncryptionService();
            string password      = "******";
            string hasedPassword = passwordEncryption.EncryptPassword(password);

            Assert.IsNotNull(hasedPassword);

            string samePassword = "******";

            Assert.IsTrue(passwordEncryption.VerifyPassword(samePassword, hasedPassword));
        }
Beispiel #2
0
        public void CompareFalseEncrytionTest_EncryptsAPasswordTwiceAndThenComparesBothToBeDifferentByVerifyMethod_FailsIfTheyAreEqual()
        {
            PasswordEncryptionService passwordEncryption = new PasswordEncryptionService();
            string password       = "******";
            string hashedPassword = passwordEncryption.EncryptPassword(password);

            Assert.IsNotNull(hashedPassword);

            // Last letter is different
            string secondPassword = "******";

            Assert.IsFalse(passwordEncryption.VerifyPassword(secondPassword, hashedPassword));
        }