Esempio n. 1
0
        public void Equal(string a, string b)
        {
            var aSegment = parser.ParseSingleSegment <Segment>(a);
            var bSegment = parser.ParseSingleSegment <Segment>(b);

            Assume.That(aSegment, Is.Not.Null);
            Assume.That(bSegment, Is.Not.Null);

            Assert.That(aSegment, Is.EqualTo(bSegment).Using(comparer));
            Assert.That(comparer.GetHashCode(aSegment !), Is.EqualTo(comparer.GetHashCode(bSegment !)));
        }
Esempio n. 2
0
        public void ReturnsMatchedNamedGroupValues()
        {
            var parser = new GlobParser
            {
                Variables =
                {
                    new GlobVariable("yyyy", @"\d{4}"),
                    new GlobVariable("MM",   @"\d{2}"),
                    new GlobVariable("dd",   @"\d{2}"),
                }
            };
            var segment = parser.ParseSingleSegment <WildcardSegment>("{yyyy}-{MM}-{dd}");

            var match = segment.Match("2020-01-10", false);

            Assert.That(match.Success, Is.True);
            Assert.That(match.Variables,
                        Is.EqualTo(new [] {
                new MatchedVariable("yyyy", "2020"),
                new MatchedVariable("MM", "01"),
                new MatchedVariable("dd", "10"),
            }));
        }