Esempio n. 1
0
        public void TestGivenRegexPatternToStringDictionaryWhenFindingAllMatchesThenCorrectResultReturned()
        {
            IRegexPatternDictionary <string> regexDict = BuildTestRegexPatternDict();

            string allMatches = string.Join(" ", regexDict.FindAllValuesThatMatch("a hello world day"));

            Assert.AreEqual("this is good", allMatches,
                            "Expected all matches for 'a hello world' to form the sentence 'this is good'. No other results should be returned.");
        }
Esempio n. 2
0
        public void TestGivenRegexPatternToStringDictionaryWhenCheckingForMatchesThenCorrectResultReturned()
        {
            IRegexPatternDictionary <string> regexDict = BuildTestRegexPatternDict();

            Assert.True(regexDict.HasMatch("hello"), "Expected 'hello' to have a match in the dictionary");
            Assert.True(regexDict.HasMatch("a day ago"), "Expected 'hi' to have a match in the dictionary");
            Assert.True(regexDict.HasMatch("world"), "Expected 'world' to have a match in the dictionary");
            Assert.True(regexDict.HasMatch("bob"), "Expected 'john' to have a match in the dictionary");
            Assert.False(regexDict.HasMatch("doe"), "Expected 'doe' to not have a match in the dictionary");
        }