예제 #1
0
        public void StarPatternTest(string spec, string dataKey, string expected1, string expected2)
        {
            IStarPathElement star = new StarRegexPathElement(spec);

            MatchedElement lpe = star.Match(dataKey, null);

            lpe.GetSubKeyCount().Should().Be(3);
            lpe.GetSubKeyRef(0).Should().Be(dataKey);
            lpe.GetSubKeyRef(1).Should().Be(expected1);
            lpe.GetSubKeyRef(2).Should().Be(expected2);
        }
예제 #2
0
        public void MustMatchSomethingTest()
        {
            IStarPathElement star = new StarRegexPathElement("tuna-*-*");

            star.Match("tuna--", null).Should().BeNull();
            star.Match("tuna-bob-", null).Should().BeNull();
            star.Match("tuna--bob", null).Should().BeNull();

            IStarPathElement multiMetacharStarpathelement = new StarRegexPathElement("rating-$-*-*");

            multiMetacharStarpathelement.Match("rating-capGrp1-capGrp2", null).Should().BeNull();
            multiMetacharStarpathelement.Match("rating-$capGrp1-capGrp2", null).Should().BeNull();
            multiMetacharStarpathelement.Match("rating-$-capGrp1-capGrp2", null).Should().NotBeNull();
        }