public async Task GeneratePasswordFromListAsync() { var length = 5; PasswordGeneratorBase generator = new PasswordGeneratorRT(); string[] characterSet = { PasswordGeneratorCharacterSets.Uppercase, PasswordGeneratorCharacterSets.Lowercase, PasswordGeneratorCharacterSets.Digit }; string password = await generator.GeneratePasswordAsync(length, characterSet); Assert.AreEqual(length, password.Length); Assert.IsTrue(ContainsCharactersFromFormat(password, string.Join("",characterSet))); }
public async Task GeneratePasswordFromLengthAndStringAsyncTest() { const int length = 5; PasswordGeneratorBase generator = new PasswordGeneratorRT(); const string characterSet = PasswordGeneratorCharacterSets.Uppercase; string password = await generator.GeneratePasswordAsync(length, new[] { characterSet }); Assert.AreEqual(length, password.Length); Assert.IsTrue(ContainsCharactersFromFormat(password, characterSet)); }
public async Task GeneratePasswordExcludingCharacter() { const int length = 500; string[] characterSet = { "AB" }; const string excludeCharacters = "B"; PasswordGeneratorBase generator = new PasswordGeneratorRT(); string password = await generator.GeneratePasswordAsync(length, characterSet, excludeCharacters); Assert.AreEqual(length, password.Length); Assert.IsTrue(ContainsCharactersFromFormat(password, "A")); Assert.IsTrue(DoesntContainCharactersFromFormat(password, "B")); }