public void CharacterPositionPasswordPolicyConstructor_ValidPolicy_SetsPropertiesCorrectly()
        {
            var sut = new sut.CharacterPositionPasswordPolicy('a', 10, 20);

            Assert.Equal('a', sut.RequiredCharacter);
            Assert.Equal(10, sut.LowerNumber);
            Assert.Equal(20, sut.UpperNumber);
        }
        public void CharacterPositionPasswordPolicyStringConstructor_ValidPolicy_ParsesAndSetsPropertiesCorrectly()
        {
            var sut = new sut.CharacterPositionPasswordPolicy("2-9 g");

            Assert.Equal('g', sut.RequiredCharacter);
            Assert.Equal(2, sut.LowerNumber);
            Assert.Equal(9, sut.UpperNumber);
        }
        public void PasswordMultiStringAndFactoryConstructor_GivenValidItems_SetsAppropriately()
        {
            var policyString = "5-9 b";
            var password     = "******";
            var factory      = new CharacterPositionPasswordPolicyFactory();

            var sut               = new sut.Password(policyString, password, factory);
            var policy            = new sut.CharacterPositionPasswordPolicy(policyString);
            var nonMatchingPolicy = new sut.CharacterFrequencyPasswordPolicy(policyString);

            Assert.Equal(policy, sut.PasswordPolicy);
            Assert.NotEqual(nonMatchingPolicy, sut.PasswordPolicy);
            Assert.Equal(password, sut.PasswordCandidate);
        }
        public void Validate_GivenInvalidPassword_ReturnsFalse(string passwordPolicyString, string password)
        {
            var sut = new sut.CharacterPositionPasswordPolicy(passwordPolicyString);

            Assert.False(sut.Validate(password));
        }