public void TestFindMatchingPatternWithoutMatchingTokenBounds() {
            var finder = new RegexNameFinder(new Dictionary<string, Regex[]> {
                {"match", new[] {new Regex("[0-8] year")}}
            });

            var sentence = new[] { "a", "80", "year", "c" };

            var result = finder.Find(sentence);

            Assert.AreEqual(0, result.Length);
        }
        public void TestFindTokenizedPattern() {
            var finder = new RegexNameFinder(new Dictionary<string, Regex[]> {
                {"match", new[] {new Regex("[0-9]+ year")}}
            });

            var sentence = new[] { "a", "80", "year", "b", "c" };

            var result = finder.Find(sentence);

            Assert.AreEqual(1, result.Length);
            Assert.AreEqual(1, result[0].Start);
            Assert.AreEqual(3, result[0].End);
            Assert.AreEqual("match", result[0].Type);
        }
        public void TestFindSingleTokenPattern() {
            var testPattern = new Regex("test", RegexOptions.Compiled);
            var sentence = new[] {"a", "test", "b", "c"};

            var patterns = new[] {testPattern};
            var regexMap = new Dictionary<string, Regex[]>();
            const string type = "testtype";

            regexMap.Add(type, patterns);

            var finder = new RegexNameFinder(regexMap);

            var result = finder.Find(sentence);

            Assert.AreEqual(1, result.Length);
            Assert.AreEqual(1, result[0].Start);
            Assert.AreEqual(2, result[0].End);
            Assert.AreEqual(type, result[0].Type);
        }