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

            chunkGenerator.Diagnostics.Add(
                RazorDiagnostic.Create(
                    new RazorError(
                        LegacyResources.FormatDirectiveExpectsTypeName(InheritsDirective.Directive.Directive),
                        25, 0, 25, Environment.NewLine.Length)));

            // 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")));
        }