Exemplo n.º 1
0
        internal virtual void SingleSpanBlockTest(string document, string spanContent, BlockKindInternal blockKind, SpanKindInternal spanType, AcceptedCharactersInternal acceptedCharacters, params RazorError[] expectedErrors)
        {
            var result = ParseBlock(document, designTime: false);

            var builder = new BlockBuilder();

            builder.Type = blockKind;
            var expected = ConfigureAndAddSpanToBlock(builder, Factory.Span(spanType, spanContent, spanType == SpanKindInternal.Markup).Accepts(acceptedCharacters));

            if (FixupSpans)
            {
                SpancestryCorrector.Correct(expected);

                var span = expected.FindFirstDescendentSpan();
                span.ChangeStart(SourceLocation.Zero);
            }

            SyntaxTreeVerifier.Verify(result);
            SyntaxTreeVerifier.Verify(expected);

            if (!ReferenceEquals(expected, IgnoreOutput))
            {
                EvaluateResults(result, expected, expectedErrors?.Select(error => RazorDiagnostic.Create(error)).ToList());
            }
        }
Exemplo n.º 2
0
        internal virtual void ParseDocumentTest(string document, IEnumerable <DirectiveDescriptor> directives, Block expected, bool designTime, params RazorError[] expectedErrors)
        {
            var result = ParseDocument(document, directives, designTime);

            if (FixupSpans)
            {
                SpancestryCorrector.Correct(expected);

                var span = expected.FindFirstDescendentSpan();
                span.ChangeStart(SourceLocation.Zero);
            }

            SyntaxTreeVerifier.Verify(result);
            SyntaxTreeVerifier.Verify(expected);

            if (!ReferenceEquals(expected, IgnoreOutput))
            {
                EvaluateResults(result, expected, expectedErrors?.Select(error => RazorDiagnostic.Create(error)).ToList());
            }
        }