public void Generate_AllCharacters_VerifyLength()
        {
            var subject = new SimplePasswordGenerator();

            string actual = subject.Generate(10, Charsets.All);

            Assert.That(actual, Has.Length.EqualTo(10));
        }
        public void Generate_DigitsOnly_Verify()
        {
            var subject = new SimplePasswordGenerator();

            string actual = subject.Generate(10, Charsets.Digits);

            Assert.That(actual, Has.Length.EqualTo(10)
                        .With.All.Matches <char>(char.IsNumber),
                        "ten digits");
        }
        public void Generate_AlphaNumericOnly_Verify()
        {
            var subject = new SimplePasswordGenerator();

            string actual = subject.Generate(10, Charsets.AlphaNumeric);

            Assert.That(actual, Has.Length.EqualTo(10)
                        .With.All.Matches <char>(char.IsLetterOrDigit),
                        "ten alphanumeric characters");
        }
        public void Generate_SpecialCharactersOnly_Verify()
        {
            var subject = new SimplePasswordGenerator();

            string actual = subject.Generate(10, Charsets.SpecialCharacters);

            Assert.That(actual, Has.Length.EqualTo(10)
                        .With.None.Matches <char>(char.IsLetterOrDigit),
                        "ten special characters");
        }
        public static bool CreateUser(string Email, string culture)
        {
            // Validate input
            if (string.IsNullOrEmpty(Email))
            {
                throw new ArgumentException("Argument cannot be null or empty", "Email");
            }
            Email = Email.Trim();


            // Generate a password
            IPasswordGenerator passwordGenerator = new SimplePasswordGenerator();
            string             password          = passwordGenerator.Generate(7);

            // Encrypt information
            ICrypt crypt = new SimpleCrypt();

            Email    = crypt.Encrypt(Email);
            password = crypt.Encrypt(password);

            return(DomainModel.Repository.Sql.Users.Create(Email, password, culture));
        }