Ejemplo n.º 1
0
        public void TestParseOnePattern()
        {
            matcher.AddPattern("Name: {Person.Name}");

            var person = matcher.Match <Person>("Name: Alice");

            Assert.AreEqual("Alice", person.Name);
        }
Ejemplo n.º 2
0
        public void TestTokenMatcherCoCa()
        {
            var template = ReadTemplate("whois.co.ca");
            var input    = ReadData("available.co.ca");

            var matcher = new TokenMatcher();

            matcher.RegisterTemplate(template);

            var match = matcher.Match(input);

            Assert.AreEqual(match.BestMatch.First("DomainName"), "u34jedzcq.co.ca");
            Assert.AreEqual(match.BestMatch.First("Status"), "NotFound");
        }
Ejemplo n.º 3
0
        public void TestParseOnePattern()
        {
            matcher.RegisterTemplate("Name: {Person.Name}", "Person");

            var result = matcher.Match <Person>("Name: Alice");

            var person = result.BestMatch.Value;

            Assert.AreEqual("Alice", person.Name);
        }