IsValidPassword() 공개 메소드

public IsValidPassword ( ) : bool
리턴 bool
예제 #1
0
        public void NewPasswordShouldNotBeSameAsLastThreePassword()
        {
            var password = new Password {PasswordString = "twewerer34#", CreatedOn = DateTime.Today};
            password.PswdHistory = new PasswordHistory();
            Assert.True(password.IsValidPassword());

            var priorOnePassword = new Password { PasswordString = "twewerer34#" };
            priorOnePassword.CreatedOn = DateTime.Today.AddDays(-12);

            password.PswdHistory.Add(priorOnePassword);
            Assert.False(password.IsValidPassword());
        }
예제 #2
0
        public void ShouldSatisfyAtleastThreeValidationRules()
        {
            var password = new Password();

            var passwordToMatchRuleCountDict = new Dictionary<string, int>
                                                   {
                                                       {"12345678", 1},
                                                       {"1234567A", 2},
                                                       {"1234567a", 2},
                                                       {"1234567#", 2},
                                                       {"123456A#", 3}
                                                   };
            foreach (KeyValuePair<String, int> passwordCountPair in passwordToMatchRuleCountDict){
                password.PasswordString = passwordCountPair.Key;
                if (passwordCountPair.Value < 3){
                    Assert.IsFalse(password.IsValidPassword());
                }
                else{
                    Assert.IsTrue(password.IsValidPassword());
                }
            }
        }