public void TestGivenRegexPatternToStringDictionaryWithFullMatchPatternWhenCheckingForMatchesThenCorrectResultReturned() { IRegexPatternDictionary <string> regexDict = new RegexPatternDictionaryImpl <string>(); regexDict.AddFullMatchPattern("hello", "this"); regexDict.AddFullMatchPattern("wo+rld", "is"); regexDict.AddFullMatchPattern("a.*y", "good"); regexDict.AddFullMatchPattern("b.*", "bad"); Assert.True(regexDict.HasMatch("hello"), "Expected 'hello' to have a match in the dictionary"); Assert.True(regexDict.HasMatch("wooorld"), "Expected 'wooorld' to have a match in the dictionary"); Assert.True(regexDict.HasMatch("a day"), "Expected 'a day' to have a match in the dictionary"); Assert.True(regexDict.HasMatch("before"), "Expected 'before' to have a match in the dictionary"); Assert.False(regexDict.HasMatch("a day ago"), "Expected 'a day ago' to not have a match in the dictionary"); Assert.False(regexDict.HasMatch("day before"), "Expected 'day before' to not have a match in the dictionary"); }
public void TestGivenRegexPatternToStringDictionaryWithEscapedPatternWhenCheckingForMatchesThenCorrectResultReturned() { IRegexPatternDictionary <string> regexDict = new RegexPatternDictionaryImpl <string>(); regexDict.AddEscapedFullMatchPattern("hello", "this"); regexDict.AddEscapedFullMatchPattern("wo+rld", "is"); regexDict.AddEscapedFullMatchPattern("a.*y", "good"); regexDict.AddEscapedFullMatchPattern("b.*", "bad"); Assert.True(regexDict.HasMatch("hello"), "Expected 'hello' to have a match in the dictionary"); Assert.True(regexDict.HasMatch("a.*y"), "Expected 'a.*y' to have a match in the dictionary"); Assert.False(regexDict.HasMatch("hi"), "Expected 'hi' to not have a match in the dictionary"); Assert.False(regexDict.HasMatch("week"), "Expected 'week' to not have a match in the dictionary"); Assert.False(regexDict.HasMatch("john"), "Expected 'john' to not have a match in the dictionary"); Assert.False(regexDict.HasMatch("doe"), "Expected 'doe' to not have a match in the dictionary"); }