Пример #1
0
        public void ParseMethodCallsParseDocumentOnMarkupParserAndReturnsResults()
        {
            // Arrange
            var factory = new SpanFactory();
            var parser  = new RazorParser();

            // Act/Assert
            ParserTestBase.EvaluateResults(parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")),
                                           new MarkupBlock(
                                               factory.Markup("foo "),
                                               new ExpressionBlock(
                                                   factory.CodeTransition(),
                                                   factory.Code("bar")
                                                   .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
                                                   .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                                               factory.Markup(" baz")));
        }
Пример #2
0
        public void ParseMethodUsesProvidedParserListenerIfSpecified()
        {
            // Arrange
            var factory = new SpanFactory();
            var parser  = new RazorParser();

            // Act
            var results = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz"));

            // Assert
            ParserTestBase.EvaluateResults(results,
                                           new MarkupBlock(
                                               factory.Markup("foo "),
                                               new ExpressionBlock(
                                                   factory.CodeTransition(),
                                                   factory.Code("bar")
                                                   .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
                                                   .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                                               factory.Markup(" baz")));
        }