public void PrecompiledRegex_Groups()
        {
            RegexTestClass testClass = new RegexTestClass();

            Assert.Equal(text, testClass.Match(text).Groups[0].Value);
            Assert.Equal(new int[] { 0, 1, 2 }, testClass.GetGroupNumbers());
            Assert.Equal(new string[] { "0", "1", "output" }, testClass.GetGroupNames());
        }
예제 #2
0
        public void TestPrecompiledRegex()
        {
            string         text      = "asdf134success1245something";
            RegexTestClass testClass = new RegexTestClass();

            Assert.Equal(1, testClass.Matches(text).Count);
            Assert.Equal(1, testClass.Match(text).Groups[0].Captures.Count);
            Assert.Equal(text, testClass.Match(text).Groups[0].Value);
            Assert.Equal(new int[] { 0, 1, 2 }, testClass.GetGroupNumbers());
            Assert.Equal(new string[] { "0", "1", "output" }, testClass.GetGroupNames());
        }