public void Retrieve_500CommonPasswords_GetsList() { var list = StandardWordListRetriever.Retrieve(StandardWordList.MostCommon500Passwords); var expected = WordLists.MostCommon500Passwords; Assert.AreEqual(expected, list); }
public void Retrieve_AllEnumValues_GetsListWithoutIssue() { var lists = (StandardWordList[])Enum.GetValues(typeof(StandardWordList)); foreach (var list in lists) { var currentList = list; Assert.DoesNotThrow(() => StandardWordListRetriever.Retrieve(currentList), "Expected to get a word list for " + currentList); } }
public override bool Validate(string password) { var regex = GetRegexForPassword(password); foreach (var standardWordList in Settings.StandardWordLists) { string wordList = StandardWordListRetriever.Retrieve(standardWordList); if (regex.IsMatch(wordList)) { return(false); } } return(true); }