Port existing CSharp code generation integration tests.

- Added code generation test infrastructure to validate ported tests.

#847
This commit is contained in:
N. Taylor Mullen 2016-12-09 17:23:58 -08:00
parent 5d4c4e1ccf
commit eb230e0408
88 changed files with 3354 additions and 50 deletions

View File

@ -40,8 +40,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution
var irDocument = pass.Execute(codeDocument: null, irDocument: originalIRDocument);
// Assert
var @namespace = SingleChild<NamespaceDeclarationIRNode>(irDocument);
var @class = SingleChild<ClassDeclarationIRNode>(@namespace);
Children(irDocument,
node => Assert.IsType<ChecksumIRNode>(node),
node => Assert.IsType<NamespaceDeclarationIRNode>(node));
var @namespace = irDocument.Children[1];
Children(@namespace,
node => Assert.IsType<UsingStatementIRNode>(node),
node => Assert.IsType<UsingStatementIRNode>(node),
node => Assert.IsType<ClassDeclarationIRNode>(node));
var @class = (ClassDeclarationIRNode)@namespace.Children[2];
Assert.Equal(@class.BaseType, "Hello<World[]>");
}
@ -57,8 +64,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution
var irDocument = pass.Execute(codeDocument: null, irDocument: originalIRDocument);
// Assert
var @namespace = SingleChild<NamespaceDeclarationIRNode>(irDocument);
var @class = SingleChild<ClassDeclarationIRNode>(@namespace);
Children(irDocument,
node => Assert.IsType<ChecksumIRNode>(node),
node => Assert.IsType<NamespaceDeclarationIRNode>(node));
var @namespace = irDocument.Children[1];
Children(@namespace,
node => Assert.IsType<UsingStatementIRNode>(node),
node => Assert.IsType<UsingStatementIRNode>(node),
node => Assert.IsType<ClassDeclarationIRNode>(node));
var @class = @namespace.Children[2];
Children(@class,
node => Assert.IsType<RazorMethodDeclarationIRNode>(node),
node => CSharpStatement(" var value = true; ", node));

View File

@ -72,36 +72,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
Assert.NotNull(document.GetSyntaxTree());
Assert.NotNull(document.GetIRDocument());
}
[Fact]
public void Process_CustomDirective()
{
// Arrange
var engine = RazorEngine.Create(b =>
{
b.AddDirective(DirectiveDescriptorBuilder.Create("test_directive").Build());
});
var document = RazorCodeDocument.Create(TestRazorSourceDocument.Create("@test_directive"));
// Act
engine.Process(document);
// Assert
var syntaxTree = document.GetSyntaxTree();
// This is fragile for now, but we don't want to invest in the legacy API until we're ready
// to replace it properly.
var directiveBlock = (Block)syntaxTree.Root.Children[1];
var directiveSpan = (Span)directiveBlock.Children[1];
Assert.Equal("test_directive", directiveSpan.Content);
var irDocument = document.GetIRDocument();
var irNamespace = irDocument.Children[1];
var irClass = irNamespace.Children[2];
var irMethod = irClass.Children[0];
var irDirective = (DirectiveIRNode)irMethod.Children[1];
Assert.Equal("test_directive", irDirective.Name);
}
}
}

View File

@ -109,5 +109,36 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
var baseline = testFile.ReadAllText().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
RazorIRNodeVerifier.Verify(document, baseline);
}
protected void AssertCSharpDocumentMatchesBaseline(RazorCSharpDocument document)
{
if (Filename == null)
{
var message = $"{nameof(AssertCSharpDocumentMatchesBaseline)} should only be called from an integration test ({nameof(Filename)} is null).";
throw new InvalidOperationException(message);
}
var baselineFilename = Path.ChangeExtension(Filename, ".codegen.cs");
if (GenerateBaselines)
{
var baselineFullPath = Path.Combine(TestProjectRoot, baselineFilename);
File.WriteAllText(baselineFullPath, document.GeneratedCode);
return;
}
var testFile = TestFile.Create(baselineFilename);
if (!testFile.Exists())
{
throw new XunitException($"The resource {baselineFilename} was not found.");
}
var baseline = testFile.ReadAllText();
// Normalize newlines to match those in the baseline.
var actual = document.GeneratedCode.Replace("\r", "").Replace("\n", "\r\n");
Assert.Equal(baseline, actual);
}
}
}

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Razor.Evolution.Intermediate;
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
@ -145,7 +146,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
if (node.SourceRange != null)
{
_writer.Write(node.SourceRange.ToString());
var sourceRange = node.SourceRange;
_writer.Write("(");
_writer.Write(sourceRange.AbsoluteIndex);
_writer.Write(":");
_writer.Write(sourceRange.LineIndex);
_writer.Write(",");
_writer.Write(sourceRange.CharacterIndex);
_writer.Write(" [");
_writer.Write(sourceRange.ContentLength);
_writer.Write("] ");
var fileName = sourceRange.FilePath.Substring(sourceRange.FilePath.LastIndexOf('/') + 1);
_writer.Write(fileName);
_writer.Write(")");
}
}

View File

@ -0,0 +1,601 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Evolution.Intermediate;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
{
public class RuntimeCodeGenerationIntegrationTest : IntegrationTestBase
{
[Fact]
public void UnfinishedExpressionInCode()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Templates()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void StringLiterals()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void SimpleUnspacedIf()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Sections()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void RazorComments()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ParserError()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void OpenedIf()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void NullConditionalExpressions()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void NoLinePragmas()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void NestedCSharp()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void NestedCodeBlocks()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void MarkupInCodeBlock()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Instrumented()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void InlineBlocks()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Inherits()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Imports()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ImplicitExpressionAtEOF()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ImplicitExpression()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void HtmlCommentWithQuote_Double()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void HtmlCommentWithQuote_Single()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void HiddenSpansInCode()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void FunctionsBlock()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void FunctionsBlockMinimal()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ExpressionsInCode()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ExplicitExpressionWithMarkup()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ExplicitExpressionAtEOF()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ExplicitExpression()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void EmptyImplicitExpressionInCode()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void EmptyImplicitExpression()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void EmptyExplicitExpression()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void EmptyCodeBlock()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void DesignTime()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void ConditionalAttributes()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void CodeBlockWithTextElement()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void CodeBlockAtEOF()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void CodeBlock()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Blocks()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
[Fact]
public void Await()
{
// Arrange
var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter()));
var document = CreateCodeDocument();
// Act
engine.Process(document);
// Assert
AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument());
}
private class ApiSetsIRTestAdapter : IRazorIRPass
{
public RazorEngine Engine { get; set; }
public int Order { get; set; }
public DocumentIRNode Execute(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
{
var walker = new ApiSetsIRWalker();
walker.Visit(irDocument);
return irDocument;
}
private class ApiSetsIRWalker : RazorIRNodeWalker
{
public override void VisitClass(ClassDeclarationIRNode node)
{
node.Name = Filename.Replace('/', '_');
node.AccessModifier = "public";
VisitDefault(node);
}
public override void VisitNamespace(NamespaceDeclarationIRNode node)
{
node.Content = typeof(RuntimeCodeGenerationIntegrationTest).Namespace + ".TestFiles";
VisitDefault(node);
}
public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node)
{
node.AccessModifier = "public";
node.Modifiers = new[] { "async" };
node.ReturnType = typeof(Task).FullName;
node.Name = "ExecuteAsync";
VisitDefault(node);
}
}
}
}
}

View File

@ -5,6 +5,6 @@ Document -
UsingStatement - - System.Threading.Tasks
ClassDeclaration - - - - -
RazorMethodDeclaration - - - - -
HtmlContent - (0:0,0 [0] TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.cshtml) -
HtmlContent - (0:0,0 [0] CustomDirective.cshtml) -
Directive - - test_directive
HtmlContent - (15:0,15 [0] TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.cshtml) -
HtmlContent - (15:0,15 [0] CustomDirective.cshtml) -

View File

@ -5,4 +5,4 @@ Document -
UsingStatement - - System.Threading.Tasks
ClassDeclaration - - - - -
RazorMethodDeclaration - - - - -
HtmlContent - (0:0,0 [0] TestFiles/IntegrationTests/BasicIntegrationTest/Empty.cshtml) -
HtmlContent - (0:0,0 [0] Empty.cshtml) -

View File

@ -5,4 +5,4 @@ Document -
UsingStatement - - System.Threading.Tasks
ClassDeclaration - - - - -
RazorMethodDeclaration - - - - -
HtmlContent - (0:0,0 [13] TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.cshtml) - Hello, World!
HtmlContent - (0:0,0 [13] HelloWorld.cshtml) - Hello, World!

View File

@ -1,10 +1,13 @@
Document -
Checksum -
NamespaceDeclaration - -
UsingStatement - - System
UsingStatement - - System.Threading.Tasks
ClassDeclaration - - - - -
RazorMethodDeclaration - - - - -
HtmlContent - (0:0,0 [6] ) - <html>\n<body>\n <span
HtmlAttribute - (25:2,9 [13] ) - val=" - "
CSharpAttributeValue - (31:2,15 [6] ) -
CSharpExpression - (32:2,16 [5] )
CSharpToken - (32:2,16 [5] ) - Hello
HtmlContent - (38:2,22 [3] ) - />\n</body>\n</html>"
HtmlContent - (0:0,0 [6] HtmlWithConditionalAttribute.cshtml) - <html>\n<body>\n <span
HtmlAttribute - (25:2,9 [13] HtmlWithConditionalAttribute.cshtml) - val=" - "
CSharpAttributeValue - (31:2,15 [6] HtmlWithConditionalAttribute.cshtml) -
CSharpExpression - (32:2,16 [5] HtmlWithConditionalAttribute.cshtml)
CSharpToken - (32:2,16 [5] HtmlWithConditionalAttribute.cshtml) - Hello
HtmlContent - (38:2,22 [3] HtmlWithConditionalAttribute.cshtml) - />\n</body>\n</html>"

View File

@ -1,8 +1,11 @@
Document -
Checksum -
NamespaceDeclaration - -
UsingStatement - - System
UsingStatement - - System.Threading.Tasks
ClassDeclaration - - - - -
RazorMethodDeclaration - - - - -
HtmlContent - (0:0,0 [6] ) - <html>\n<body>\n <span data-val="
CSharpExpression - (37:2,21 [5] )
CSharpToken - (37:2,21 [5] ) - Hello
HtmlContent - (42:2,26 [1] ) - " />\n</body>\n</html>"
HtmlContent - (0:0,0 [6] HtmlWithDataDashAttribute.cshtml) - <html>\n<body>\n <span data-val="
CSharpExpression - (37:2,21 [5] HtmlWithDataDashAttribute.cshtml)
CSharpToken - (37:2,21 [5] HtmlWithDataDashAttribute.cshtml) - Hello
HtmlContent - (42:2,26 [1] HtmlWithDataDashAttribute.cshtml) - " />\n</body>\n</html>"

View File

@ -0,0 +1,100 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "00b5e01b7a405dcfde7e4d512ee930daaa1778b5"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Await
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n<section>\r\n <h1>Basic Asynchronous Expression Test</h1>\r\n <p>Basic Asynchronous Expression: ");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo());
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Basic Asynchronous Template: ");
#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo());
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement: ");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
await Foo();
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement Nested: <b>");
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo());
#line default
#line hidden
WriteLiteral("</b> ");
WriteLiteral("</p>\r\n <p>Basic Incomplete Asynchronous Statement: ");
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await);
#line default
#line hidden
WriteLiteral("</p>\r\n</section>\r\n\r\n<section>\r\n <h1>Advanced Asynchronous Expression Test</h1>\r\n <p>Advanced Asynchronous Expression: ");
#line 19 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo(1, 2));
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Expression Extended: ");
#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo.Bar(1, 2));
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Template: ");
#line 21 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo("bob", true));
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement: ");
#line 22 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
await Foo(something, hello: "world");
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement Extended: ");
#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
await Foo.Bar(1, 2)
#line default
#line hidden
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement Nested: <b>");
#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await Foo(boolValue: false));
#line default
#line hidden
WriteLiteral("</b> ");
WriteLiteral("</p>\r\n <p>Advanced Incomplete Asynchronous Statement: ");
#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
Write(await ("wrrronggg"));
#line default
#line hidden
WriteLiteral("</p>\r\n</section>");
}
#pragma warning restore 1998
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml"
public async Task<string> Foo()
{
return "Bar";
}
#line default
#line hidden
}
}

View File

@ -0,0 +1,26 @@
@functions {
public async Task<string> Foo()
{
return "Bar";
}
}
<section>
<h1>Basic Asynchronous Expression Test</h1>
<p>Basic Asynchronous Expression: @await Foo()</p>
<p>Basic Asynchronous Template: @(await Foo())</p>
<p>Basic Asynchronous Statement: @{ await Foo(); }</p>
<p>Basic Asynchronous Statement Nested: @{ <b>@await Foo()</b> }</p>
<p>Basic Incomplete Asynchronous Statement: @await</p>
</section>
<section>
<h1>Advanced Asynchronous Expression Test</h1>
<p>Advanced Asynchronous Expression: @await Foo(1, 2)</p>
<p>Advanced Asynchronous Expression Extended: @await Foo.Bar(1, 2)</p>
<p>Advanced Asynchronous Template: @(await Foo("bob", true))</p>
<p>Advanced Asynchronous Statement: @{ await Foo(something, hello: "world"); }</p>
<p>Advanced Asynchronous Statement Extended: @{ await Foo.Bar(1, 2) }</p>
<p>Advanced Asynchronous Statement Nested: @{ <b>@await Foo(boolValue: false)</b> }</p>
<p>Advanced Incomplete Asynchronous Statement: @await ("wrrronggg")</p>
</section>

View File

@ -0,0 +1,147 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ba7d8f5f5159a2389c780aa606885ef6c917a45a"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Blocks
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
int i = 1;
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
while(i <= 10) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
i += 1;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
if(i == 11) {
#line default
#line hidden
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
switch(i) {
case 11:
#line default
#line hidden
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
break;
default:
#line default
#line hidden
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
break;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
WriteLiteral(" <p>Hello again from C#, #");
#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
Write(j);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
try {
#line default
#line hidden
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
#line 29 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
} catch(Exception ex) {
#line default
#line hidden
WriteLiteral(" <p>Oh no! An error occurred: ");
#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
Write(ex.Message);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 31 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n<p>i is now ");
#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n\r\n");
#line 35 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
lock(new object()) {
#line default
#line hidden
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
#line 37 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,37 @@
@{
int i = 1;
}
@while(i <= 10) {
<p>Hello from C#, #@(i)</p>
i += 1;
}
@if(i == 11) {
<p>We wrote 10 lines!</p>
}
@switch(i) {
case 11:
<p>No really, we wrote 10 lines!</p>
break;
default:
<p>Actually, we didn't...</p>
break;
}
@for(int j = 1; j <= 10; j += 2) {
<p>Hello again from C#, #@(j)</p>
}
@try {
<p>That time, we wrote 5 lines!</p>
} catch(Exception ex) {
<p>Oh no! An error occurred: @(ex.Message)</p>
}
<p>i is now @i</p>
@lock(new object()) {
<p>This block is locked, for your security!</p>
}

View File

@ -0,0 +1,24 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "019ce8023d064d08ca88c597b764aea895ec5841"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlock
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml"
for(int i = 1; i <= 10; i++) {
Output.Write("<p>Hello from C#, #" + i.ToString() + "</p>");
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,5 @@
@{
for(int i = 1; i <= 10; i++) {
Output.Write("<p>Hello from C#, #" + i.ToString() + "</p>");
}
}

View File

@ -0,0 +1,15 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5f82673b13daf5e28291f3bfb58df5e3a94e13cc"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlockAtEOF
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,34 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "13e48ff59aab8106ceb68dd4a10b0bdf10c322fc"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlockWithTextElement
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml"
var a = 1;
#line default
#line hidden
WriteLiteral("foo");
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml"
var b = 1;
#line default
#line hidden
WriteLiteral("bar ");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml"
Write(a+b);
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,4 @@
@{
var a = 1; <text>foo</text>
var b = 1; <text>bar @(a+b)</text>
}

View File

@ -0,0 +1,104 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "088be4e50958bcab0f1d1ac04d2c28dcd8049bf5"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ConditionalAttributes
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
var ch = true;
var cls = "bar";
#line default
#line hidden
WriteLiteral(" <a href=\"Foo\" />\r\n <p");
BeginWriteAttribute("class", " class=\"", 74, "\"", 86, 1);
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue("", 82, cls, 82, 4, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" />\r\n <p");
BeginWriteAttribute("class", " class=\"", 98, "\"", 114, 2);
WriteAttributeValue("", 106, "foo", 106, 3, true);
#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue(" ", 109, cls, 110, 4, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" />\r\n <p");
BeginWriteAttribute("class", " class=\"", 126, "\"", 142, 2);
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue("", 134, cls, 134, 4, false);
#line default
#line hidden
WriteAttributeValue(" ", 138, "foo", 139, 4, true);
EndWriteAttribute();
WriteLiteral(" />\r\n <input type=\"checkbox\"");
BeginWriteAttribute("checked", " checked=\"", 174, "\"", 187, 1);
#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue("", 184, ch, 184, 3, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" />\r\n <input type=\"checkbox\"");
BeginWriteAttribute("checked", " checked=\"", 219, "\"", 236, 2);
WriteAttributeValue("", 229, "foo", 229, 3, true);
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue(" ", 232, ch, 233, 3, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" />\r\n <p");
BeginWriteAttribute("class", " class=\"", 248, "\"", 281, 1);
WriteAttributeValue("", 256, new HelperResult(async(__razor_attribute_value_writer) => {
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
if(cls != null) {
#line default
#line hidden
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteTo(__razor_attribute_value_writer, cls);
#line default
#line hidden
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
}
#line default
#line hidden
}
), 256, 25, false);
EndWriteAttribute();
WriteLiteral(" />\r\n <a href=\"~/Foo\" />\r\n <script");
BeginWriteAttribute("src", " src=\"", 322, "\"", 373, 1);
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue("", 328, Url.Content("~/Scripts/jquery-1.6.2.min.js"), 328, 45, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script");
BeginWriteAttribute("src", " src=\"", 420, "\"", 487, 1);
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
WriteAttributeValue("", 426, Url.Content("~/Scripts/modernizr-2.0.6-development-only.js"), 426, 61, false);
#line default
#line hidden
EndWriteAttribute();
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script src=\"http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js\" type=\"text/javascript\"></script>\r\n");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,15 @@
@{
var ch = true;
var cls = "bar";
<a href="Foo" />
<p class="@cls" />
<p class="foo @cls" />
<p class="@cls foo" />
<input type="checkbox" checked="@ch" />
<input type="checkbox" checked="foo @ch" />
<p class="@if(cls != null) { @cls }" />
<a href="~/Foo" />
<script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
}

View File

@ -0,0 +1,67 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "fa44b61006e587564a67bc785a9beeb41425a016"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_DesignTime
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<div>\r\n");
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
WriteLiteral(" <p>This is item #");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n\r\n<p>\r\n");
#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
Write(Foo(Bar.Baz));
#line default
#line hidden
WriteLiteral("\r\n");
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
Write(Foo(item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<p>Bar ");
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
WriteTo(__razor_template_writer, baz);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " Biz</p>");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</p>\r\n\r\n");
DefineSection("Footer", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, "\r\n <p>Foo</p>\r\n ");
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml"
WriteTo(__razor_section_writer, bar);
#line default
#line hidden
WriteLiteralTo(__razor_section_writer, "\r\n");
}
);
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,15 @@
<div>
@for(int i = 1; i <= 10; i++) {
<p>This is item #@i</p>
}
</div>
<p>
@(Foo(Bar.Baz))
@Foo(@<p>Bar @baz Biz</p>)
</p>
@section Footer {
<p>Foo</p>
@bar
}

View File

@ -0,0 +1,16 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a81f9de6dc302ab6600f3808428e5247ed389511"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyCodeBlock
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("This is markup\r\n\r\n");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,21 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e6467906896d16277c5a0cf962ac6d863c58852f"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyExplicitExpression
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("This is markup\r\n\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml"
Write();
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,22 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8ed47ba5d7cac644fdbb2c4f816d49bdeed1ac45"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyImplicitExpression
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("This is markup\r\n\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml"
Write();
#line default
#line hidden
WriteLiteral("!");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,20 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b21853e37dde51b305bde9602624934d4d6affd3"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyImplicitExpressionInCode
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml"
Write();
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,21 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a897a227b26c531d644bdff988df46d3c8178346"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpression
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("1 + 1 = ");
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml"
Write(1+1);
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,21 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "bf53afff8ab65f1af9b9a82f9a571f1cd023dfc0"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpressionAtEOF
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("This is markup\r\n\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml"
Write();
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,24 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1252c799cdeb86a71e4304f01ebaae540fa26894"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpressionWithMarkup
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<div>");
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml"
Write(item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "</div>");
}
));
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,69 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8c7ae67489dbddec9f2dbef3c2b65def1149e507"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExpressionsInCode
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
object foo = null;
string bar = "Foo";
#line default
#line hidden
WriteLiteral("\r\n");
#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
if(foo != null) {
#line default
#line hidden
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
Write(foo);
#line default
#line hidden
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
} else {
#line default
#line hidden
WriteLiteral(" <p>Foo is Null!</p>\r\n");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n<p>\r\n");
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
if(!String.IsNullOrEmpty(bar)) {
#line default
#line hidden
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
Write(bar.Replace("F", "B"));
#line default
#line hidden
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml"
}
#line default
#line hidden
WriteLiteral("</p>");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,16 @@
@{
object foo = null;
string bar = "Foo";
}
@if(foo != null) {
@foo
} else {
<p>Foo is Null!</p>
}
<p>
@if(!String.IsNullOrEmpty(bar)) {
@(bar.Replace("F", "B"))
}
</p>

View File

@ -0,0 +1,32 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "94813053694a285515d791c48d703f1131881d0c"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_FunctionsBlock
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n");
WriteLiteral("\r\nHere\'s a random number: ");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml"
Write(RandomInt());
#line default
#line hidden
}
#pragma warning restore 1998
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml"
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
#line default
#line hidden
}
}

View File

@ -0,0 +1,12 @@
@functions {
}
@functions {
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
}
Here's a random number: @RandomInt()

View File

@ -0,0 +1,25 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "366e1cb1c026413435ec398a7d47c8c1acc373d8"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_FunctionsBlockMinimal
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n\r\n");
}
#pragma warning restore 1998
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml"
string foo(string input) {
return input + "!";
}
#line default
#line hidden
}
}

View File

@ -0,0 +1,7 @@

@functions{
string foo(string input) {
return input + "!";
}
}

View File

@ -0,0 +1,21 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5bd51d8947ca920e594be8d214b4ebee2888c90c"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HiddenSpansInCode
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml"
@Da
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,16 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a07711bc1fd0478b3b8329a68ab2028ef93429df"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HtmlCommentWithQuote_Double
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<!-- \" -->\r\n<img src=\"~/images/submit.png\" />");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,16 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2d9bb4407e7aac9563aaeac9f0534a48f54e3d44"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HtmlCommentWithQuote_Single
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<!-- \' -->\r\n<img src=\"~/images/submit.png\" />");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,33 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "77befd9645f3c2d9ab48b935faebf9f731f42abc"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ImplicitExpression
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
WriteLiteral(" <p>This is item #");
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,3 @@
@for(int i = 1; i <= 10; i++) {
<p>This is item #@i</p>
}

View File

@ -0,0 +1,21 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ecf286733e30e006a630f3a5fe87c21f45e4c807"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ImplicitExpressionAtEOF
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("This is markup\r\n\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml"
Write();
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,33 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f452adb7c255f6d9d6d2573c6add7cb28022b151"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
using System.IO;
using Foo = System.Text.Encoding;
using static System;
using static System.Console;
using static global::System.Text.Encoding;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Imports
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n\r\n<p>Path\'s full type name is ");
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml"
Write(typeof(Path).FullName);
#line default
#line hidden
WriteLiteral("</p>\r\n<p>Foo\'s actual full type name is ");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml"
Write(typeof(Foo).FullName);
#line default
#line hidden
WriteLiteral("</p>");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,10 @@
@using System.IO
@using Foo = System.Text.Encoding
@using System
@using static System
@using static System.Console
@using static global::System.Text.Encoding
<p>Path's full type name is @typeof(Path).FullName</p>
<p>Foo's actual full type name is @typeof(Foo).FullName</p>

View File

@ -0,0 +1,22 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "72d6e21c6366f99a17c63abebb46db3470f4d1da"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Inherits : foo.bar<baz<biz>>.boz
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml"
Write(foo());
#line default
#line hidden
WriteLiteral("\r\n\r\n");
WriteLiteral("bar\r\n");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,3 @@
@foo()
@inherits foo.bar<baz<biz>>.boz bar

View File

@ -0,0 +1,46 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e827e93343a95c7254a19287b095dfba9390d29f"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_InlineBlocks
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
DefineSection("Link", async(__razor_section_writer) => {
}
);
WriteLiteral("(string link) {\r\n <a");
BeginWriteAttribute("href", " href=\"", 36, "\"", 93, 1);
WriteAttributeValue("", 43, new HelperResult(async(__razor_attribute_value_writer) => {
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml"
if(link != null) {
#line default
#line hidden
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml"
WriteTo(__razor_attribute_value_writer, link);
#line default
#line hidden
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml"
} else {
#line default
#line hidden
WriteLiteralTo(__razor_attribute_value_writer, "#");
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml"
}
#line default
#line hidden
}
), 43, 50, false);
EndWriteAttribute();
WriteLiteral(" />\r\n}");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,3 @@
@section Link(string link) {
<a href="@if(link != null) { @link } else { <text>#</text> }" />
}

View File

@ -0,0 +1,152 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9b521264e3e64710635c0f0490a368845d90da66"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Instrumented
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
int i = 1;
var foo =
#line default
#line hidden
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<p>Bar</p>");
}
)
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
;
#line default
#line hidden
WriteLiteral(" Hello, World\r\n <p>Hello, World</p>\r\n");
WriteLiteral("\r\n");
#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
while(i <= 10) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
i += 1;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
if(i == 11) {
#line default
#line hidden
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
#line 15 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
switch(i) {
case 11:
#line default
#line hidden
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
break;
default:
#line default
#line hidden
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
break;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 26 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
WriteLiteral(" <p>Hello again from C#, #");
#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
Write(j);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 28 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
try {
#line default
#line hidden
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
#line 32 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
} catch(Exception ex) {
#line default
#line hidden
WriteLiteral(" <p>Oh no! An error occurred: ");
#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
Write(ex.Message);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 36 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
lock(new object()) {
#line default
#line hidden
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
#line 38 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,38 @@
@{
int i = 1;
var foo = @<p>Bar</p>;
@:Hello, World
<p>Hello, World</p>
}
@while(i <= 10) {
<p>Hello from C#, #@(i)</p>
i += 1;
}
@if(i == 11) {
<p>We wrote 10 lines!</p>
}
@switch(i) {
case 11:
<p>No really, we wrote 10 lines!</p>
break;
default:
<p>Actually, we didn't...</p>
break;
}
@for(int j = 1; j <= 10; j += 2) {
<p>Hello again from C#, #@(j)</p>
}
@try {
<p>That time, we wrote 5 lines!</p>
} catch(Exception ex) {
<p>Oh no! An error occurred: @(ex.Message)</p>
}
@lock(new object()) {
<p>This block is locked, for your security!</p>
}

View File

@ -0,0 +1,35 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "cf059b36d7e93e260c1d5b852f7a59e6c99ae33d"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_MarkupInCodeBlock
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml"
Write(i.ToString());
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,5 @@
@{
for(int i = 1; i <= 10; i++) {
<p>Hello from C#, #@(i.ToString())</p>
}
}

View File

@ -0,0 +1,34 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2b9e8dcf7c08153c15ac84973938a7c0254f2369"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NestedCSharp
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml"
foreach (var result in (dynamic)Url)
{
#line default
#line hidden
WriteLiteral(" <div>\r\n ");
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml"
Write(result.SomeValue);
#line default
#line hidden
WriteLiteral(".\r\n </div>\r\n");
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,8 @@
@{
@foreach (var result in (dynamic)Url)
{
<div>
@result.SomeValue.
</div>
}
}

View File

@ -0,0 +1,33 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a4eb7397719094ea9da5b7d6674d317314fa26b4"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NestedCodeBlocks
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml"
if(foo) {
#line default
#line hidden
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml"
if(bar) {
}
#line default
#line hidden
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,148 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "682929a2038f56f4737f1b7aa3c9eaa5488cc001"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NoLinePragmas
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
int i = 1;
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
while(i <= 10) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
i += 1;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
if(i == 11) {
#line default
#line hidden
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
switch(i) {
case 11:
#line default
#line hidden
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
break;
default:
#line default
#line hidden
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
break;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
WriteLiteral(" <p>Hello again from C#, #");
#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
Write(j);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
try {
#line default
#line hidden
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
#line 29 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
} catch(Exception ex) {
#line default
#line hidden
WriteLiteral(" <p>Oh no! An error occurred: ");
#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
Write(ex.Message);
#line default
#line hidden
WriteLiteral("</p>\r\n");
#line 31 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
}
#line default
#line hidden
WriteLiteral("<p>i is now ");
#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
Write(i);
#line default
#line hidden
WriteLiteral("</p>\r\n\r\n");
#line 36 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
lock(new object()) {
#line default
#line hidden
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
#line 38 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,38 @@
@{
int i = 1;
}
@while(i <= 10) {
<p>Hello from C#, #@(i)</p>
i += 1;
}
@if(i == 11) {
<p>We wrote 10 lines!</p>
}
@switch(i) {
case 11:
<p>No really, we wrote 10 lines!</p>
break;
default:
<p>Actually, we didn't...</p>
break;
}
@for(int j = 1; j <= 10; j += 2) {
<p>Hello again from C#, #@(j)</p>
}
@try {
<p>That time, we wrote 5 lines!</p>
} catch(Exception ex) {
<p>Oh no! An error occurred: @(ex.Message)</p>
}
@* With has no equivalent in C# *@
<p>i is now @i</p>
@lock(new object()) {
<p>This block is locked, for your security!</p>
}

View File

@ -0,0 +1,59 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c8c4f34e0768aea12ef6ce8e3fe0e384ad023faf"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NullConditionalExpressions
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag?.Data);
#line default
#line hidden
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag.IntIndexer?[0]);
#line default
#line hidden
#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag.StrIndexer?["key"]);
#line default
#line hidden
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag?.Method(Value?[23]?.More)?["key"]);
#line default
#line hidden
WriteLiteral("\r\n");
#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag?.Data);
#line default
#line hidden
WriteLiteral("\r\n");
#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag.IntIndexer?[0]);
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag.StrIndexer?["key"]);
#line default
#line hidden
WriteLiteral("\r\n");
#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml"
Write(ViewBag?.Method(Value?[23]?.More)?["key"]);
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,11 @@
@{
@ViewBag?.Data
@ViewBag.IntIndexer?[0]
@ViewBag.StrIndexer?["key"]
@ViewBag?.Method(Value?[23]?.More)?["key"]
}
@ViewBag?.Data
@ViewBag.IntIndexer?[0]
@ViewBag.StrIndexer?["key"]
@ViewBag?.Method(Value?[23]?.More)?["key"]

View File

@ -0,0 +1,23 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "608d7aa10b6df6798d8259379837fa7ffb088ed6"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_OpenedIf
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<html>\r\n<body>\r\n");
#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml"
if (true) {
#line default
#line hidden
WriteLiteral("</body>\r\n</html>");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,5 @@
<html>
<body>
@if (true) {
</body>
</html>

View File

@ -0,0 +1,24 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99e6be6b384d3f247935d3cb15564542b7a82e43"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ParserError
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml"
/*
int i =10;
int j =20;
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,50 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "45c16f152aef80d7de27c7df32dc522af5842197"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_RazorComments
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n<p>This should be shown</p>\r\n\r\n");
#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml"
Exception foo =
#line default
#line hidden
#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml"
null;
if(foo != null) {
throw foo;
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml"
var bar = "@* bar *@";
#line default
#line hidden
WriteLiteral("<p>But this should show the comment syntax: ");
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml"
Write(bar);
#line default
#line hidden
WriteLiteral("</p>\r\n\r\n");
#line 15 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml"
Write(ab);
#line default
#line hidden
WriteLiteral("\r\n");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,15 @@
@*This is not going to be rendered*@
<p>This should @* not *@ be shown</p>
@{
@* throw new Exception("Oh no!") *@
Exception foo = @* new Exception("Oh no!") *@ null;
if(foo != null) {
throw foo;
}
}
@{ var bar = "@* bar *@"; }
<p>But this should show the comment syntax: @bar</p>
@(a@**@b)

View File

@ -0,0 +1,66 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ec9a74381c339244a887565526c11056ece494a3"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Sections
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml"
Layout = "_SectionTestLayout.cshtml"
#line default
#line hidden
WriteLiteral("\r\n<div>This is in the Body>\r\n\r\n");
DefineSection("Section2", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, "\r\n <div");
BeginWriteAttributeTo(__razor_section_writer, "class", " class=\"", 109, "\"", 128, 2);
WriteAttributeValueTo(__razor_section_writer, "", 117, "some", 117, 4, true);
#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml"
WriteAttributeValueTo(__razor_section_writer, " ", 121, thing, 122, 6, false);
#line default
#line hidden
EndWriteAttributeTo(__razor_section_writer);
WriteLiteralTo(__razor_section_writer, ">This is in Section 2</div>\r\n");
}
);
WriteLiteral("\r\n");
DefineSection("Section1", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, "\r\n <div>This is in Section 1</div>\r\n");
}
);
WriteLiteral("\r\n");
DefineSection("NestedDelegates", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, "\r\n");
#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml"
Func<dynamic, object> f =
#line default
#line hidden
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<span>");
#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "</span>");
}
)
#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml"
;
#line default
#line hidden
}
);
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,17 @@
@{
Layout = "_SectionTestLayout.cshtml"
}
<div>This is in the Body>
@section Section2 {
<div class="some @thing">This is in Section 2</div>
}
@section Section1 {
<div>This is in Section 1</div>
}
@section NestedDelegates {
@{ Func<dynamic, object> f = @<span>@item</span>; }
}

View File

@ -0,0 +1,28 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8501407d5716c727ebc0ba157b04442cd2c302ff"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_SimpleUnspacedIf
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml"
if (true)
{
#line default
#line hidden
WriteLiteral("\t<div></div>\r\n");
#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,264 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3c21118a6113e76e4f71d17e3ae081f13d451427"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_StringLiterals
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral(@"<p>This is line 1</p>
<p>This is line 2</p>
<p>This is line 3</p>
<p>This is line 4</p>
<p>This is line 5</p>
<p>This is line 6</p>
<p>This is line 7</p>
<p>This is line 8</p>
<p>This is line 9</p>
<p>This is line 10</p>
<p>This is line 11</p>
<p>This is line 12</p>
<p>This is line 13</p>
<p>This is line 14</p>
<p>This is line 15</p>
<p>This is line 16</p>
<p>This is line 17</p>
<p>This is line 18</p>
<p>This is line 19</p>
<p>This is line 20</p>
<p>This is line 21</p>
<p>This is line 22</p>
<p>This is line 23</p>
<p>This is line 24</p>
<p>This is line 25</p>
<p>This is line 26</p>
<p>This is line 27</p>
<p>This is line 28</p>
<p>This is line 29</p>
<p>This is line 30</p>
<p>This is line 31</p>
<p>This is line 32</p>
<p>This is line 33</p>
<p>This is line 34</p>
<p>This is line 35</p>
<p>This is line 36</p>
<p>This is line 37</p>
<p>This is line 38</p>
<p>This is line 39</p>
<p>This is line 40</p>
<p>This is line 41</p>
<p>This is line 42</p>
<p>This is line 43</p>
<");
WriteLiteral(@"p>This is line 44</p>
<p>This is line 45</p>
<p>This is line 46</p>
<p>This is line 47</p>
<p>This is line 48</p>
<p>This is line 49</p>
<p>This is line 50</p>
<p>This is line 51</p>
<p>This is line 52</p>
<p>This is line 53</p>
<p>This is line 54</p>
<p>This is line 55</p>
<p>This is line 56</p>
<p>This is line 57</p>
<p>This is line 58</p>
<p>This is line 59</p>
<p>This is line 60</p>
<p>This is line 61</p>
<p>This is line 62</p>
<p>This is line 63</p>
<p>This is line 64</p>
<p>This is line 65</p>
<p>This is line 66</p>
<p>This is line 67</p>
<p>This is line 68</p>
<p>This is line 69</p>
<p>This is line 70</p>
<p>This is line 71</p>
<p>This is line 72</p>
<p>This is line 73</p>
<p>This is line 74</p>
<p>This is line 75</p>
<p>This is line 76</p>
<p>This is line 77</p>
<p>This is line 78</p>
<p>This is line 79</p>
<p>This is line 80</p>
<p>This is line 81</p>
<p>This is line 82</p>
<p>This is line 83</p>
<p>This is line 84</p><br>
");
DefineSection("WriteLiteralsToInHere", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, @"
<p>This is line 1 nested</p>
<p>This is line 2 nested</p>
<p>This is line 3 nested</p>
<p>This is line 4 nested</p>
<p>This is line 5 nested</p>
<p>This is line 6 nested</p>
<p>This is line 7 nested</p>
<p>This is line 8 nested</p>
<p>This is line 9 nested</p>
<p>This is line 10 nested</p>
<p>This is line 11 nested</p>
<p>This is line 12 nested</p>
<p>This is line 13 nested</p>
<p>This is line 14 nested</p>
<p>This is line 15 nested</p>
<p>This is line 16 nested</p>
<p>This is line 17 nested</p>
<p>This is line 18 nested</p>
<p>This is line 19 nested</p>
<p>This is line 20 nested</p>
<p>This is line 21 nested</p>
<p>This is line 22 nested</p>
<p>This is line 23 nested</p>
<p>This is line 24 nested</p>
<p>This is line 25 nested</p>
<p>This is line 26 nested</p>
<p>This is line 27 nested</p>
<p>This is line 28 nested</p>
<p>This is line 29 nested</p>
<p>This is l");
WriteLiteralTo(__razor_section_writer, @"ine 30 nested</p>
<p>This is line 31 nested</p>
<p>This is line 32 nested</p>
<p>This is line 33 nested</p>
<p>This is line 34 nested</p>
<p>This is line 35 nested</p>
<p>This is line 36 nested</p>
<p>This is line 37 nested</p>
<p>This is line 38 nested</p>
<p>This is line 39 nested</p>
<p>This is line 40 nested</p>
<p>This is line 41 nested</p>
<p>This is line 42 nested</p>
<p>This is line 43 nested</p>
<p>This is line 44 nested</p>
<p>This is line 45 nested</p>
<p>This is line 46 nested</p>
<p>This is line 47 nested</p>
<p>This is line 48 nested</p>
<p>This is line 49 nested</p>
<p>This is line 50 nested</p>
<p>This is line 51 nested</p>
<p>This is line 52 nested</p>
<p>This is line 53 nested</p>
<p>This is line 54 nested</p>
<p>This is line 55 nested</p>
<p>This is line 56 nested</p>
<p>This is line 57 nested</p>
<p>This is line 58 nested</p>
<p>This is line 59 ne");
WriteLiteralTo(__razor_section_writer, @"sted</p>
<p>This is line 60 nested</p>
<p>This is line 61 nested</p>
<p>This is line 62 nested</p>
<p>This is line 63 nested</p>
<p>This is line 64 nested</p>
<p>This is line 65 nested</p>
<p>This is line 66 nested</p>
<p>This is line 67 nested</p>
<p>This is line 68 nested</p>
<p>This is line 69 nested</p>
<p>This is line 70 nested</p>
<p>This is line 71 nested</p>
<p>This is line 72 nested</p>
<p>This is line 73 nested</p>
<p>This is line 74 nested</p>
<p>This is line 75 nested</p>
");
}
);
WriteLiteral(@"<p>This is line 1</p>
<p>This is line 2</p>
<p>This is line 3</p>
<p>This is line 4</p>
<p>This is line 5</p>
<p>This is line 6</p>
<p>This is line 7</p>
<p>This is line 8</p>
<p>This is line 9</p>
<p>This is line 10</p>
<p>This is line 11</p>
<p>This is line 12</p>
<p>This is line 13</p>
<p>This is line 14</p>
<p>This is line 15</p>
<p>This is line 16</p>
<p>This is line 17</p>
<p>This is line 18</p>
<p>This is line 19</p>
<p>This is line 20</p>
<p>This is line 21</p>
<p>This is line 22</p>
<p>This is line 23</p>
<p>This is line 24</p>
<p>This is line 25</p>
<p>This is line 26</p>
<p>This is line 27</p>
<p>This is line 28</p>
<p>This is line 29</p>
<p>This is line 30</p>
<p>This is line 31</p>
<p>This is line 32</p>
<p>This is line 33</p>
<p>This is line 34</p>
<p>This is line 35</p>
<p>This is line 36</p>
<p>This is line 37</p>
<p>This is line 38</p>
<p>This is line 39</p>
<p>This is line 40</p>
<p>This is line 41</p>
<p>This is line 42</p>
<p>This is line 43</p>hi!");
WriteLiteral("\r\n");
DefineSection("WriteLiteralsToInHereAlso", async(__razor_section_writer) => {
WriteLiteralTo(__razor_section_writer, @"
<p>This is line 1 nested</p>
<p>This is line 2 nested</p>
<p>This is line 3 nested</p>
<p>This is line 4 nested</p>
<p>This is line 5 nested</p>
<p>This is line 6 nested</p>
<p>This is line 7 nested</p>
<p>This is line 8 nested</p>
<p>This is line 9 nested</p>
<p>This is line 10 nested</p>
<p>This is line 11 nested</p>
<p>This is line 12 nested</p>
<p>This is line 13 nested</p>
<p>This is line 14 nested</p>
<p>This is line 15 nested</p>
<p>This is line 16 nested</p>
<p>This is line 17 nested</p>
<p>This is line 18 nested</p>
<p>This is line 19 nested</p>
<p>This is line 20 nested</p>
<p>This is line 21 nested</p>
<p>This is line 22 nested</p>
<p>This is line 23 nested</p>
<p>This is line 24 nested</p>
<p>This is line 25 nested</p>
<p>This is line 26 nested</p>
<p>This is line 27 nested</p>
<p>This is line 28 nested</p>
<p>This is line 29 nested</p>
<p>30</p>
");
}
);
WriteLiteral("!");
}
#pragma warning restore 1998
}
}

View File

@ -0,0 +1,237 @@
<p>This is line 1</p>
<p>This is line 2</p>
<p>This is line 3</p>
<p>This is line 4</p>
<p>This is line 5</p>
<p>This is line 6</p>
<p>This is line 7</p>
<p>This is line 8</p>
<p>This is line 9</p>
<p>This is line 10</p>
<p>This is line 11</p>
<p>This is line 12</p>
<p>This is line 13</p>
<p>This is line 14</p>
<p>This is line 15</p>
<p>This is line 16</p>
<p>This is line 17</p>
<p>This is line 18</p>
<p>This is line 19</p>
<p>This is line 20</p>
<p>This is line 21</p>
<p>This is line 22</p>
<p>This is line 23</p>
<p>This is line 24</p>
<p>This is line 25</p>
<p>This is line 26</p>
<p>This is line 27</p>
<p>This is line 28</p>
<p>This is line 29</p>
<p>This is line 30</p>
<p>This is line 31</p>
<p>This is line 32</p>
<p>This is line 33</p>
<p>This is line 34</p>
<p>This is line 35</p>
<p>This is line 36</p>
<p>This is line 37</p>
<p>This is line 38</p>
<p>This is line 39</p>
<p>This is line 40</p>
<p>This is line 41</p>
<p>This is line 42</p>
<p>This is line 43</p>
<p>This is line 44</p>
<p>This is line 45</p>
<p>This is line 46</p>
<p>This is line 47</p>
<p>This is line 48</p>
<p>This is line 49</p>
<p>This is line 50</p>
<p>This is line 51</p>
<p>This is line 52</p>
<p>This is line 53</p>
<p>This is line 54</p>
<p>This is line 55</p>
<p>This is line 56</p>
<p>This is line 57</p>
<p>This is line 58</p>
<p>This is line 59</p>
<p>This is line 60</p>
<p>This is line 61</p>
<p>This is line 62</p>
<p>This is line 63</p>
<p>This is line 64</p>
<p>This is line 65</p>
<p>This is line 66</p>
<p>This is line 67</p>
<p>This is line 68</p>
<p>This is line 69</p>
<p>This is line 70</p>
<p>This is line 71</p>
<p>This is line 72</p>
<p>This is line 73</p>
<p>This is line 74</p>
<p>This is line 75</p>
<p>This is line 76</p>
<p>This is line 77</p>
<p>This is line 78</p>
<p>This is line 79</p>
<p>This is line 80</p>
<p>This is line 81</p>
<p>This is line 82</p>
<p>This is line 83</p>
<p>This is line 84</p><br>
@section WriteLiteralsToInHere {
<p>This is line 1 nested</p>
<p>This is line 2 nested</p>
<p>This is line 3 nested</p>
<p>This is line 4 nested</p>
<p>This is line 5 nested</p>
<p>This is line 6 nested</p>
<p>This is line 7 nested</p>
<p>This is line 8 nested</p>
<p>This is line 9 nested</p>
<p>This is line 10 nested</p>
<p>This is line 11 nested</p>
<p>This is line 12 nested</p>
<p>This is line 13 nested</p>
<p>This is line 14 nested</p>
<p>This is line 15 nested</p>
<p>This is line 16 nested</p>
<p>This is line 17 nested</p>
<p>This is line 18 nested</p>
<p>This is line 19 nested</p>
<p>This is line 20 nested</p>
<p>This is line 21 nested</p>
<p>This is line 22 nested</p>
<p>This is line 23 nested</p>
<p>This is line 24 nested</p>
<p>This is line 25 nested</p>
<p>This is line 26 nested</p>
<p>This is line 27 nested</p>
<p>This is line 28 nested</p>
<p>This is line 29 nested</p>
<p>This is line 30 nested</p>
<p>This is line 31 nested</p>
<p>This is line 32 nested</p>
<p>This is line 33 nested</p>
<p>This is line 34 nested</p>
<p>This is line 35 nested</p>
<p>This is line 36 nested</p>
<p>This is line 37 nested</p>
<p>This is line 38 nested</p>
<p>This is line 39 nested</p>
<p>This is line 40 nested</p>
<p>This is line 41 nested</p>
<p>This is line 42 nested</p>
<p>This is line 43 nested</p>
<p>This is line 44 nested</p>
<p>This is line 45 nested</p>
<p>This is line 46 nested</p>
<p>This is line 47 nested</p>
<p>This is line 48 nested</p>
<p>This is line 49 nested</p>
<p>This is line 50 nested</p>
<p>This is line 51 nested</p>
<p>This is line 52 nested</p>
<p>This is line 53 nested</p>
<p>This is line 54 nested</p>
<p>This is line 55 nested</p>
<p>This is line 56 nested</p>
<p>This is line 57 nested</p>
<p>This is line 58 nested</p>
<p>This is line 59 nested</p>
<p>This is line 60 nested</p>
<p>This is line 61 nested</p>
<p>This is line 62 nested</p>
<p>This is line 63 nested</p>
<p>This is line 64 nested</p>
<p>This is line 65 nested</p>
<p>This is line 66 nested</p>
<p>This is line 67 nested</p>
<p>This is line 68 nested</p>
<p>This is line 69 nested</p>
<p>This is line 70 nested</p>
<p>This is line 71 nested</p>
<p>This is line 72 nested</p>
<p>This is line 73 nested</p>
<p>This is line 74 nested</p>
<p>This is line 75 nested</p>
}
<p>This is line 1</p>
<p>This is line 2</p>
<p>This is line 3</p>
<p>This is line 4</p>
<p>This is line 5</p>
<p>This is line 6</p>
<p>This is line 7</p>
<p>This is line 8</p>
<p>This is line 9</p>
<p>This is line 10</p>
<p>This is line 11</p>
<p>This is line 12</p>
<p>This is line 13</p>
<p>This is line 14</p>
<p>This is line 15</p>
<p>This is line 16</p>
<p>This is line 17</p>
<p>This is line 18</p>
<p>This is line 19</p>
<p>This is line 20</p>
<p>This is line 21</p>
<p>This is line 22</p>
<p>This is line 23</p>
<p>This is line 24</p>
<p>This is line 25</p>
<p>This is line 26</p>
<p>This is line 27</p>
<p>This is line 28</p>
<p>This is line 29</p>
<p>This is line 30</p>
<p>This is line 31</p>
<p>This is line 32</p>
<p>This is line 33</p>
<p>This is line 34</p>
<p>This is line 35</p>
<p>This is line 36</p>
<p>This is line 37</p>
<p>This is line 38</p>
<p>This is line 39</p>
<p>This is line 40</p>
<p>This is line 41</p>
<p>This is line 42</p>
<p>This is line 43</p>hi!
@section WriteLiteralsToInHereAlso {
<p>This is line 1 nested</p>
<p>This is line 2 nested</p>
<p>This is line 3 nested</p>
<p>This is line 4 nested</p>
<p>This is line 5 nested</p>
<p>This is line 6 nested</p>
<p>This is line 7 nested</p>
<p>This is line 8 nested</p>
<p>This is line 9 nested</p>
<p>This is line 10 nested</p>
<p>This is line 11 nested</p>
<p>This is line 12 nested</p>
<p>This is line 13 nested</p>
<p>This is line 14 nested</p>
<p>This is line 15 nested</p>
<p>This is line 16 nested</p>
<p>This is line 17 nested</p>
<p>This is line 18 nested</p>
<p>This is line 19 nested</p>
<p>This is line 20 nested</p>
<p>This is line 21 nested</p>
<p>This is line 22 nested</p>
<p>This is line 23 nested</p>
<p>This is line 24 nested</p>
<p>This is line 25 nested</p>
<p>This is line 26 nested</p>
<p>This is line 27 nested</p>
<p>This is line 28 nested</p>
<p>This is line 29 nested</p>
<p>30</p>
}!

View File

@ -0,0 +1,141 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ecd19ba0b3ae7ac597e19534c93fd2023208ae59"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Templates
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("\r\n");
#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Func<dynamic, object> foo =
#line default
#line hidden
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "This works ");
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "!");
}
)
#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
;
#line default
#line hidden
#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(foo(""));
#line default
#line hidden
WriteLiteral("\r\n<ul>\r\n");
#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(Repeat(10, item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<li>Item #");
#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "</li>");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</ul>\r\n\r\n<p>\r\n");
#line 21 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(Repeat(10,
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, " This is line#");
#line 22 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</p>\r\n\r\n<p>\r\n");
#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(Repeat(10,
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, ": This is line#");
#line 28 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " of markup<br />\r\n");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</p>\r\n\r\n<p>\r\n");
#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(Repeat(10,
item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, ":: This is line#");
#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " of markup<br />\r\n");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</p>\r\n\r\n\r\n<ul>\r\n ");
#line 40 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
Write(Repeat(10, item => new HelperResult(async(__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
#line 41 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "\r\n");
#line 42 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
var parent = item;
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " <ul>\r\n <li>Child Items... ?</li>\r\n </ul>\r\n </li>");
}
)));
#line default
#line hidden
WriteLiteral("\r\n</ul> ");
}
#pragma warning restore 1998
#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml"
public HelperResult Repeat(int times, Func<int, object> template) {
return new HelperResult((writer) => {
for(int i = 0; i < times; i++) {
((HelperResult)template(i)).WriteTo(writer);
}
});
}
#line default
#line hidden
}
}

View File

@ -0,0 +1,48 @@
@functions {
public HelperResult Repeat(int times, Func<int, object> template) {
return new HelperResult((writer) => {
for(int i = 0; i < times; i++) {
((HelperResult)template(i)).WriteTo(writer);
}
});
}
}
@{
Func<dynamic, object> foo = @<text>This works @item!</text>;
@foo("")
}
<ul>
@(Repeat(10, @<li>Item #@item</li>))
</ul>
<p>
@Repeat(10,
@: This is line#@item of markup<br/>
)
</p>
<p>
@Repeat(10,
@:: This is line#@item of markup<br />
)
</p>
<p>
@Repeat(10,
@::: This is line#@item of markup<br />
)
</p>
<ul>
@Repeat(10, @<li>
Item #@item
@{var parent = item;}
<ul>
<li>Child Items... ?</li>
@*Repeat(10, @<li>Item #@(parent).@item</li>)*@
</ul>
</li>)
</ul>

View File

@ -0,0 +1,20 @@
#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "80cd1011b7b46797f36c184b68c352568ccc5060"
namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
{
#line hidden
using System;
using System.Threading.Tasks;
public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_UnfinishedExpressionInCode
{
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml"
Write(DateTime.);
#line default
#line hidden
}
#pragma warning restore 1998
}
}