public void SetupData() { _testMatchingStringsList = new List <string>(NumberOfMatches); _testNonMatchingStringsList = new List <string>(NumberOfMatches); _glob = Globbing.Glob.Parse(GlobPattern); var generator = new GlobMatchStringGenerator(_glob.Tokens); for (int i = 0; i < 10000; i++) { _testMatchingStringsList.Add(generator.GenerateRandomMatch()); _testNonMatchingStringsList.Add(generator.GenerateRandomNonMatch()); } }
public void Can_Generate_Matches(string pattern, int volume) { // var generatedStrings = new List<string>(testStrings); var glob = Glob.Parse(pattern); var sut = new GlobMatchStringGenerator(glob.Tokens); for (int i = 0; i < volume; i++) { var generatedString = sut.GenerateRandomMatch(); var result = glob.IsMatch(generatedString); Assert.True(result, string.Format("{0} did not match pattern {1}", generatedString, pattern)); } }