Esempio n. 1
0
        public void InheritsBlockOutputsErrorIfInheritsNotFollowedByTypeButAcceptsEntireLineAsCode()
        {
            // Arrange
            var chunkGenerator = new DirectiveChunkGenerator(InheritsDirective.Directive);

            chunkGenerator.Diagnostics.Add(
                RazorDiagnosticFactory.CreateParsing_DirectiveExpectsTypeName(
                    new SourceSpan(new SourceLocation(25, 0, 25), Environment.NewLine.Length),
                    InheritsDirective.Directive.Directive));

            // Act & Assert
            ParseDocumentTest(
                "@inherits                " + Environment.NewLine + "foo",
                new[] { InheritsDirective.Directive },
                new MarkupBlock(
                    Factory.EmptyHtml(),
                    new DirectiveBlock(chunkGenerator,
                                       Factory.CodeTransition(),
                                       Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None),
                                       Factory.Span(SpanKindInternal.Code, "                ", CSharpSymbolType.WhiteSpace).Accepts(AcceptedCharactersInternal.WhiteSpace),
                                       Factory.Span(SpanKindInternal.Code, string.Empty, CSharpSymbolType.Unknown)
                                       .AsDirectiveToken(DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Type))),
                    Factory.Markup(Environment.NewLine + "foo")));
        }