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)); }
public void ParserUsesFilter() { Parser parser = ParserTestCase.CreateParser("// Foo"); Assert.That(parser.AtEof, Is.True); }