public override bool Matches(object actual)
        {
            string source       = (string)actual;
            Parser parser       = ParserTestCase.CreateParser(source);
            string actualString = parser.ParseRule(_ruleType).Inspect();

            if (!parser.AtEof)
            {
                throw new InvalidOperationException("Rule did not consume all input");
            }
            return(base.Matches(actualString));
        }
        public override ConstraintResult ApplyTo <TActual>(TActual actual)
        {
            string source       = actual.ToString();
            Parser parser       = ParserTestCase.CreateParser(source);
            string actualString = parser.ParseRule(_ruleType).Inspect();

            if (!parser.AtEof)
            {
                throw new InvalidOperationException("Rule did not consume all input");
            }
            return(base.ApplyTo(actualString));
        }
示例#3
0
        public void ParserUsesFilter()
        {
            Parser parser = ParserTestCase.CreateParser("// Foo");

            Assert.That(parser.AtEof, Is.True);
        }