コード例 #1
0
        public void PasswordHasSymbolsAndLowerLetters()
        {
            var symbols = new[] { '!', '@', '#' };
            var pass    = PasswordCode.CreatePassword(PasswordLength, false, false, symbols);

            Assert.IsTrue(pass.All(x => char.IsLower(x) || symbols.Contains(x)));
        }
コード例 #2
0
        public void SimplestPasswordIsWorking()
        {
            var pass = PasswordCode.CreatePassword(5, false, false, new char[0]);

            Assert.IsNotNull(pass);
            Assert.IsInstanceOfType(pass, typeof(string));
            Assert.IsTrue(pass.Length == 5);
        }
コード例 #3
0
        public void PasswordHasEverything()
        {
            var symbols = new[] { '!', '@', '#' };
            var pass    = PasswordCode.CreatePassword(PasswordLength, true, true, symbols);

            Assert.IsTrue(pass.Any(char.IsLower));
            Assert.IsTrue(pass.Any(char.IsDigit));
            Assert.IsTrue(pass.Any(char.IsUpper));
            Assert.IsTrue(pass.Any(x => symbols.Contains(x)));
        }
コード例 #4
0
        public void PasswordHasDigitsAndUpperLetters()
        {
            var pass = PasswordCode.CreatePassword(PasswordLength, true, true, new char[0]);

            Assert.IsTrue(pass.Any(char.IsDigit) && pass.Any(char.IsUpper));
        }
コード例 #5
0
        public void PasswordHasDigits()
        {
            var pass = PasswordCode.CreatePassword(PasswordLength, false, true, new char[0]);

            Assert.IsTrue(pass.Any(char.IsDigit));
        }
コード例 #6
0
        public void PasswordHasOnlyLowerLetters()
        {
            var pass = PasswordCode.CreatePassword(PasswordLength, false, false, new char[0]);

            Assert.IsTrue(pass.All(char.IsLower));
        }