public void GenerateAPassword()
        {
            var core     = new PasswordCore(new RandomPasswordProvider(wordStringSource));
            var password = core.GetPassword();

            Assert.IsNotNull(password);
        }
        public void GenerateAPasswordWithoutspaces()
        {
            var minLength = 8;
            var options   = new PasswordRequestOptions {
                MinimumLength = minLength, CaseType = new CaseTypeLettersAndNumbersMixedCasing(), SpecialCharacter = true
            };
            var core     = new PasswordCore(new RandomPasswordProvider(wordStringSource));
            var password = core.GetPassword(options);

            Assert.IsNotNull(password);
            Assert.IsTrue(!password.All(char.IsWhiteSpace));
        }
        public void GenerateAPasswordWithMixedCaseLettersOnly()
        {
            var minLength = 8;
            var options   = new PasswordRequestOptions {
                MinimumLength = minLength, CaseType = new CaseTypeLettersMixedCasing()
            };
            var core     = new PasswordCore(new RandomPasswordProvider(wordStringSource));
            var password = core.GetPassword(options);

            Assert.IsNotNull(password);
            Assert.IsTrue(Regex.Replace(password, @"\s+", "").All(char.IsLetter));
        }
        public void GenerateAPasswordWithMixedCase()
        {
            var minLength = 8;
            var options   = new PasswordRequestOptions {
                MinimumLength = minLength, CaseType = new CaseTypeLettersAndNumbersMixedCasing()
            };
            var core     = new PasswordCore(new RandomPasswordProvider(wordStringSource));
            var password = core.GetPassword(options);

            Assert.IsNotNull(password);
            Assert.IsTrue(password.Any(char.IsUpper) && password.Any(char.IsLower));
        }
        public void GenerateAPasswordWithMinimumLength()
        {
            var minLength = 8;
            var options   = new PasswordRequestOptions {
                MinimumLength = minLength
            };
            var core     = new PasswordCore(new RandomPasswordProvider(wordStringSource));
            var password = core.GetPassword(options);

            Assert.IsNotNull(password);
            Assert.IsTrue(password.Length >= 8);
        }
Exemplo n.º 6
0
        public void GenerateAPasswordWithNumbersOnly()
        {
            var minLength = 8;
            var options   = new PasswordRequestOptions {
                MinimumLength = minLength, CaseType = new CaseTypeNumbers()
            };
            var core     = new PasswordCore(new RandomPasswordProvider(randomStringSource));
            var password = core.GetPassword(options);

            Assert.IsNotNull(password);
            Assert.IsTrue(password.All(char.IsDigit));
        }