Example #1
0
        public void CheckSecurityAnswers_Pass()
        {
            //Arrange
            var    newUser = tu.CreateUserObject();
            string secA1   = "Pizza";
            string secA2   = "Cyan";
            string secA3   = "Hiking";

            newUser.SecurityQ1Answer = secA1;
            newUser.SecurityQ2Answer = secA2;
            newUser.SecurityQ3Answer = secA3;
            tu.CreateUserInDb(newUser);
            var           newlyAddedPasswordReset = pm.CreatePasswordReset(newUser.Id);
            List <string> submittedAnswers        = new List <string>
            {
                "Pizza",
                "Cyan",
                "Hiking"
            };
            //Act
            var response = pm.CheckSecurityAnswers(newlyAddedPasswordReset.ResetToken, submittedAnswers);

            //Assert
            Assert.IsNotNull(response);
            Assert.IsTrue(response);
        }
Example #2
0
        public void CheckSecurityAnswers_Fail()
        {
            //Arrange
            var    newUser = tu.CreateUserObject();
            string secA1   = "Pizza";
            string secA2   = "Cyan";
            string secA3   = "Hiking";

            newUser.SecurityQ1Answer = secA1;
            newUser.SecurityQ2Answer = secA2;
            newUser.SecurityQ3Answer = secA3;
            tu.CreateUserInDb(newUser);
            using (_db = tu.CreateDataBaseContext())
            {
                PasswordManager pm = new PasswordManager(_db);
                var             newlyAddedPasswordReset = pm.CreatePasswordReset(newUser.Id);
                List <string>   submittedAnswers        = new List <string>
                {
                    "Pizza",
                    "Cyan",
                    "Photography"
                };
                //Act
                var response = pm.CheckSecurityAnswers(newlyAddedPasswordReset.ResetToken, submittedAnswers);
                //Assert
                Assert.IsNotNull(response);
                Assert.IsFalse(response);
            }
        }