public EditWindow(string path, string content, PasswordGenerationConfig options) { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); passwordGenerator = new PasswordGenerator(options); CreateCheckboxes(); Title = $"Editing '{path}'"; PasswordContent.Text = content; PasswordContent.Focus(); }
public PasswordWindow(string filename, PasswordGenerationConfig options) { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); passwordGenerator = new PasswordGenerator(options); CreateCheckboxes(); Title = "Add new password"; AddDefaultMetadata(filename); RegeneratePassword(); Password.Focus(); }
public void GeneratePassword_MatchesRequiredLength() { var options = new PasswordGenerationConfig { Length = 32 }; using (var generator = new PasswordGenerator(options)) { var password = generator.GeneratePassword(); password.Length.ShouldBe(32); } }
public void GeneratePassword_NoCharacterGroups_Null() { var options = new PasswordGenerationConfig { Length = 32, CharacterGroups = new CharacterGroupConfig[0] }; using (var generator = new PasswordGenerator(options)) { var password = generator.GeneratePassword(); password.ShouldBeNull(); } }
public void GeneratePassword_OnlyContainsAllowedCharacters(string allowedCharacters) { var options = new PasswordGenerationConfig { CharacterGroups = new [] { new CharacterGroupConfig("test", allowedCharacters, true), } }; using (var generator = new PasswordGenerator(options)) { var password = generator.GeneratePassword(); password.ShouldBeSubsetOf(allowedCharacters); } }
public PasswordGenerator(PasswordGenerationConfig options) { Options = options; }