", literalChunk.Text);
var span = Assert.IsType(literalChunk.Association);
@@ -100,7 +99,7 @@ namespace Microsoft.AspNet.Razor
}
[Fact]
- public void AddLiteralChunk_AddsChunkToCodeTree_IfPreviousChunkWasNotLiteral()
+ public void AddLiteralChunk_AddsChunkToChunkTree_IfPreviousChunkWasNotLiteral()
{
// Arrange
var spanFactory = SpanFactory.CreateCsHtml();
@@ -108,14 +107,14 @@ namespace Microsoft.AspNet.Razor
.AsStatement()
.Builder.Build();
var literalSpan = spanFactory.Markup("").Builder.Build();
- var builder = new CodeTreeBuilder();
+ var builder = new ChunkTreeBuilder();
// Act
builder.AddStatementChunk("int a = 10;", codeSpan);
builder.AddLiteralChunk("
", literalSpan);
// Assert
- var chunks = builder.CodeTree.Chunks;
+ var chunks = builder.ChunkTree.Chunks;
Assert.Equal(2, chunks.Count);
var statementChunk = Assert.IsType(chunks[0]);
Assert.Equal("int a = 10;", statementChunk.Code);
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs
similarity index 90%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs
rename to test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs
index 509c4b973c..e32986c169 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs
@@ -2,13 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if !DNXCORE50
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.CodeGeneration;
+using Microsoft.AspNet.Razor.CodeGeneration.Visitors;
using Moq;
using Moq.Protected;
using Xunit;
-namespace Microsoft.AspNet.Razor
+namespace Microsoft.AspNet.Razor.Chunks
{
public class ChunkVisitorTests
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs
similarity index 51%
rename from test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs
index c0a5cb7994..66993ef8af 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs
@@ -3,63 +3,63 @@
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator
+namespace Microsoft.AspNet.Razor.Chunks.Generators
{
- public class AddImportCodeGeneratorTest
+ public class AddImportChunkGeneratorTest
{
- public static TheoryData MatchingTestDataSet
+ public static TheoryData MatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new AddImportCodeGenerator(ns: null),
- new AddImportCodeGenerator(ns: null)
+ new AddImportChunkGenerator(ns: null),
+ new AddImportChunkGenerator(ns: null)
},
{
- new AddImportCodeGenerator(ns: "Fred"),
- new AddImportCodeGenerator(ns: "Fred")
+ new AddImportChunkGenerator(ns: "Fred"),
+ new AddImportChunkGenerator(ns: "Fred")
},
};
}
}
- public static TheoryData NonMatchingTestDataSet
+ public static TheoryData NonMatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new AddImportCodeGenerator(ns: null),
+ new AddImportChunkGenerator(ns: null),
null
},
{
- new AddImportCodeGenerator(ns: "Fred"),
+ new AddImportChunkGenerator(ns: "Fred"),
null
},
{
- new AddImportCodeGenerator(ns: "Fred"),
+ new AddImportChunkGenerator(ns: "Fred"),
new object()
},
{
- new AddImportCodeGenerator(ns: "Fred"),
- SpanCodeGenerator.Null
+ new AddImportChunkGenerator(ns: "Fred"),
+ SpanChunkGenerator.Null
},
{
- new AddImportCodeGenerator(ns: "Fred"),
- new StatementCodeGenerator()
+ new AddImportChunkGenerator(ns: "Fred"),
+ new StatementChunkGenerator()
},
{
// Different Namespace.
- new AddImportCodeGenerator(ns: "Fred"),
- new AddImportCodeGenerator(ns: "Ginger")
+ new AddImportChunkGenerator(ns: "Fred"),
+ new AddImportChunkGenerator(ns: "Ginger")
},
{
// Different Namespace (case sensitive).
- new AddImportCodeGenerator(ns: "fred"),
- new AddImportCodeGenerator(ns: "FRED")
+ new AddImportChunkGenerator(ns: "fred"),
+ new AddImportChunkGenerator(ns: "FRED")
}
};
}
@@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
- public void Equals_True_WhenExpected(AddImportCodeGenerator leftObject, AddImportCodeGenerator rightObject)
+ public void Equals_True_WhenExpected(AddImportChunkGenerator leftObject, AddImportChunkGenerator rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(NonMatchingTestDataSet))]
- public void Equals_False_WhenExpected(AddImportCodeGenerator leftObject, object rightObject)
+ public void Equals_False_WhenExpected(AddImportChunkGenerator leftObject, object rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -90,8 +90,8 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
public void GetHashCode_ReturnsSameValue_WhenEqual(
- AddImportCodeGenerator leftObject,
- AddImportCodeGenerator rightObject)
+ AddImportChunkGenerator leftObject,
+ AddImportChunkGenerator rightObject)
{
// Arrange & Act
var leftResult = leftObject.GetHashCode();
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs
similarity index 69%
rename from test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs
index 3910e0ac69..34e1122b6a 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs
@@ -4,36 +4,36 @@
using Microsoft.AspNet.Razor.Text;
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator
+namespace Microsoft.AspNet.Razor.Chunks.Generators
{
- public class AttributeBlockCodeGeneratorTest
+ public class AttributeBlockChunkGeneratorTest
{
- public static TheoryData MatchingTestDataSet
+ public static TheoryData MatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null),
- new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null)
+ new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null),
+ new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null)
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0),
suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0)),
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0),
suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0))
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)),
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15))
@@ -42,72 +42,72 @@ namespace Microsoft.AspNet.Razor.Generator
}
}
- public static TheoryData NonMatchingTestDataSet
+ public static TheoryData NonMatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null),
+ new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null),
null
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0),
suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0)),
null
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)),
null
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)),
new object()
},
{
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)),
- new RazorCommentCodeGenerator()
+ new RazorCommentChunkGenerator()
},
{
// Different Name.
- new AttributeBlockCodeGenerator(name: "Fred", prefix: null, suffix: null),
- new AttributeBlockCodeGenerator(name: "Ginger", prefix: null, suffix: null)
+ new AttributeBlockChunkGenerator(name: "Fred", prefix: null, suffix: null),
+ new AttributeBlockChunkGenerator(name: "Ginger", prefix: null, suffix: null)
},
{
// Different Name (case sensitive).
- new AttributeBlockCodeGenerator(name: "fred", prefix: null, suffix: null),
- new AttributeBlockCodeGenerator(name: "FRED", prefix: null, suffix: null)
+ new AttributeBlockChunkGenerator(name: "fred", prefix: null, suffix: null),
+ new AttributeBlockChunkGenerator(name: "FRED", prefix: null, suffix: null)
},
{
// Different Prefix.
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: null,
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: null),
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: null,
prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12),
suffix: null)
},
{
// Different Suffix.
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: null,
prefix: null,
suffix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12)),
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: null,
prefix: null,
suffix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12))
@@ -119,8 +119,8 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
public void Equals_True_WhenExpected(
- AttributeBlockCodeGenerator leftObject,
- AttributeBlockCodeGenerator rightObject)
+ AttributeBlockChunkGenerator leftObject,
+ AttributeBlockChunkGenerator rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -131,7 +131,7 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(NonMatchingTestDataSet))]
- public void Equals_False_WhenExpected(AttributeBlockCodeGenerator leftObject, object rightObject)
+ public void Equals_False_WhenExpected(AttributeBlockChunkGenerator leftObject, object rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -143,8 +143,8 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
public void GetHashCode_ReturnsSameValue_WhenEqual(
- AttributeBlockCodeGenerator leftObject,
- AttributeBlockCodeGenerator rightObject)
+ AttributeBlockChunkGenerator leftObject,
+ AttributeBlockChunkGenerator rightObject)
{
// Arrange & Act
var leftResult = leftObject.GetHashCode();
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs
similarity index 96%
rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs
index 80cc314eea..85a79789eb 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs
@@ -3,7 +3,7 @@
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
+namespace Microsoft.AspNet.Razor.CodeGeneration
{
public class CSharpCodeWriterTest
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs
similarity index 98%
rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs
index 04e1a0ab8a..964aebdf12 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs
@@ -4,7 +4,7 @@
using System;
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
+namespace Microsoft.AspNet.Razor.CodeGeneration
{
public class CSharpLineMappingWriterTest
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs
similarity index 99%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs
index 808ba93f00..6526a77aef 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
+using Microsoft.AspNet.Razor.CodeGeneration;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Xunit;
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs
similarity index 85%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs
index 417c48c2c9..d32205c80f 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs
@@ -3,14 +3,14 @@
using System;
using System.Collections.Generic;
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.Chunks.Generators;
+using Microsoft.AspNet.Razor.CodeGeneration;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Xunit;
namespace Microsoft.AspNet.Razor.Test.Generator
{
- public class CSharpRazorCodeGeneratorTest : RazorCodeGeneratorTest
+ public class RazorCodeGeneratorTest : RazorCodeGeneratorTest
{
protected override string FileExtension
{
@@ -33,19 +33,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[Fact]
public void ConstructorRequiresNonNullClassName()
{
- Assert.Throws("className", () => new CSharpRazorCodeGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost()));
+ Assert.Throws("className", () => new RazorChunkGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost()));
}
[Fact]
public void ConstructorRequiresNonEmptyClassName()
{
- Assert.Throws("className", () => new CSharpRazorCodeGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost()));
+ Assert.Throws("className", () => new RazorChunkGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost()));
}
[Fact]
public void ConstructorAllowsEmptyRootNamespaceName()
{
- new CSharpRazorCodeGenerator("Foo", string.Empty, TestPhysicalPath, CreateHost());
+ new RazorChunkGenerator("Foo", string.Empty, TestPhysicalPath, CreateHost());
}
[Theory]
@@ -68,13 +68,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[InlineData("ResolveUrl")]
[InlineData("Await")]
[InlineData("CodeBlockWithTextElement")]
- public void CSharpCodeGeneratorCorrectlyGeneratesRunTimeCode(string testType)
+ public void CSharpChunkGeneratorCorrectlyGeneratesRunTimeCode(string testType)
{
RunTest(testType);
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForNullConditionalOperator()
+ public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForNullConditionalOperator()
{
RunTest("NullConditionalExpressions",
"NullConditionalExpressions.DesignTime",
@@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForAwait()
+ public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForAwait()
{
RunTest("Await",
"Await.DesignTime",
@@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForSimpleUnspacedIf()
+ public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForSimpleUnspacedIf()
{
RunTest("SimpleUnspacedIf",
"SimpleUnspacedIf.DesignTime.Tabs",
@@ -142,7 +142,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForRazorCommentsAtDesignTime()
+ public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForRazorCommentsAtDesignTime()
{
RunTest("RazorComments", "RazorComments.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List()
@@ -157,19 +157,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGenerateMappingForOpenedCurlyIf()
+ public void CSharpChunkGeneratorCorrectlyGenerateMappingForOpenedCurlyIf()
{
OpenedIf(withTabs: true);
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGenerateMappingForOpenedCurlyIfSpaces()
+ public void CSharpChunkGeneratorCorrectlyGenerateMappingForOpenedCurlyIfSpaces()
{
OpenedIf(withTabs: false);
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesImportStatementsAtDesignTime()
+ public void CSharpChunkGeneratorCorrectlyGeneratesImportStatementsAtDesignTime()
{
RunTest("Imports", "Imports.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List()
{
@@ -185,7 +185,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime()
+ public void CSharpChunkGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime()
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime",
@@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs()
+ public void CSharpChunkGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime.Tabs",
@@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs()
+ public void CSharpChunkGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlockMinimal",
"FunctionsBlockMinimal.DesignTime.Tabs",
@@ -228,7 +228,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesHiddenSpansWithinCode()
+ public void CSharpChunkGeneratorCorrectlyGeneratesHiddenSpansWithinCode()
{
RunTest("HiddenSpansInCode", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List
{
@@ -238,7 +238,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode()
+ public void CSharpChunkGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode()
{
RunTest("ParserError", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -247,13 +247,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtRuntime()
+ public void CSharpChunkGeneratorCorrectlyGeneratesInheritsAtRuntime()
{
RunTest("Inherits", baselineName: "Inherits.Runtime");
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtDesigntime()
+ public void CSharpChunkGeneratorCorrectlyGeneratesInheritsAtDesigntime()
{
RunTest("Inherits", baselineName: "Inherits.Designtime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List()
{
@@ -263,7 +263,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode()
{
RunTest("UnfinishedExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -274,7 +274,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs()
{
RunTest("UnfinishedExpressionInCode",
"UnfinishedExpressionInCode.Tabs",
@@ -288,7 +288,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions()
{
RunTest("DesignTime",
designTimeMode: true,
@@ -307,7 +307,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF()
{
RunTest("ImplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -316,7 +316,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF()
{
RunTest("ExplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -325,7 +325,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF()
{
RunTest("CodeBlockAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -334,7 +334,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression()
{
RunTest("EmptyImplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -343,7 +343,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode()
{
RunTest("EmptyImplicitExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -354,7 +354,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs()
{
RunTest("EmptyImplicitExpressionInCode",
"EmptyImplicitExpressionInCode.Tabs",
@@ -368,7 +368,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression()
{
RunTest("EmptyExplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -377,7 +377,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock()
+ public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock()
{
RunTest("EmptyCodeBlock", designTimeMode: true, expectedDesignTimePragmas: new List()
{
@@ -386,13 +386,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse()
+ public void CSharpChunkGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse()
{
RunTest("NoLinePragmas", generatePragmas: false);
}
[Fact]
- public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
+ public void CSharpChunkGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
{
RunTest("Instrumented", hostConfig: host =>
{
@@ -403,7 +403,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes()
+ public void CSharpChunkGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes()
{
RunTest("HtmlCommentWithQuote_Single",
tabTest: TabTest.NoTabs);
@@ -413,7 +413,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGenerator_CorrectlyGeneratesAttributes_AtDesignTime()
+ public void CSharpChunkGenerator_CorrectlyGeneratesAttributes_AtDesignTime()
{
var expectedDesignTimePragmas = new[]
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs
similarity index 99%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs
index c2cc94699f..79ecc674e5 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs
@@ -6,7 +6,7 @@ using System.Linq;
#if DNXCORE50
using System.Reflection;
#endif
-using Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.CodeGeneration;
using Microsoft.AspNet.Razor.TagHelpers;
using Xunit;
@@ -728,7 +728,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGenerator_CorrectlyGeneratesMappings_ForRemoveTagHelperDirective()
+ public void CSharpChunkGenerator_CorrectlyGeneratesMappings_ForRemoveTagHelperDirective()
{
// Act & Assert
RunTagHelperTest("RemoveTagHelperDirective",
@@ -745,7 +745,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
[Fact]
- public void CSharpCodeGenerator_CorrectlyGeneratesMappings_ForAddTagHelperDirective()
+ public void CSharpChunkGenerator_CorrectlyGeneratesMappings_ForAddTagHelperDirective()
{
// Act & Assert
RunTagHelperTest("AddTagHelperDirective",
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs
similarity index 96%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs
index 82dc9efbc3..be072c84ac 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs
@@ -1,7 +1,8 @@
using System.Collections.Generic;
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
-using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
+using Microsoft.AspNet.Razor.Chunks;
+using Microsoft.AspNet.Razor.Chunks.Generators;
+using Microsoft.AspNet.Razor.CodeGeneration;
+using Microsoft.AspNet.Razor.CodeGeneration.Visitors;
using Microsoft.AspNet.Razor.TagHelpers;
using Xunit;
@@ -189,7 +190,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
private static CodeBuilderContext CreateContext()
{
return new CodeBuilderContext(
- new CodeGeneratorContext(
+ new ChunkGeneratorContext(
new RazorEngineHost(new CSharpRazorCodeLanguage()),
"MyClass",
"MyNamespace",
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs
similarity index 81%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs
index f1aec04927..ed128492f3 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs
@@ -1,8 +1,8 @@
// 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 Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
+using Microsoft.AspNet.Razor.Chunks.Generators;
+using Microsoft.AspNet.Razor.CodeGeneration;
namespace Microsoft.AspNet.Razor.Test.Generator
{
@@ -22,8 +22,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator
{
public TestCodeWriter()
{
- // We normalize newlines so no matter what platform we're on they're consistent
- // (for code generation tests).
+ // We normalize newlines so no matter what platform we're on they're consistent (for code generation
+ // tests).
NewLine = "\r\n";
}
}
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs
similarity index 88%
rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs
index 129e241f95..f518c3076e 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs
@@ -1,8 +1,8 @@
// 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 Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.Chunks.Generators;
+using Microsoft.AspNet.Razor.CodeGeneration;
namespace Microsoft.AspNet.Razor.Test.Generator
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs
similarity index 99%
rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs
index ecde0633bc..2b170c7ed9 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator.Compiler
+namespace Microsoft.AspNet.Razor.CodeGeneration
{
public class CodeWriterTest
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs
similarity index 72%
rename from test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs
index ea41510955..acc27333f4 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs
@@ -4,27 +4,27 @@
using Microsoft.AspNet.Razor.Text;
using Xunit;
-namespace Microsoft.AspNet.Razor.Generator
+namespace Microsoft.AspNet.Razor.Chunks.Generators
{
- public class DynamicAttributeBlockCodeGeneratorTest
+ public class DynamicAttributeBlockChunkGeneratorTest
{
- public static TheoryData MatchingTestDataSet
+ public static TheoryData MatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0),
- new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0)
+ new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0),
+ new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0)
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Fred", offset: 0, line: 0, col: 0),
offset: 10,
line: 11,
col: 12),
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Fred", offset: 0, line: 0, col: 0),
offset: 10,
line: 11,
@@ -32,36 +32,36 @@ namespace Microsoft.AspNet.Razor.Generator
},
// ValueStart not involved in equality check or hash code calculation.
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
col: 12),
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
offset: 100,
line: 11,
col: 12)
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
col: 12),
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12),
offset: 10,
line: 110,
col: 12)
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Dean", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
col: 12),
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Dean", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
@@ -71,18 +71,18 @@ namespace Microsoft.AspNet.Razor.Generator
}
}
- public static TheoryData NonMatchingTestDataSet
+ public static TheoryData NonMatchingTestDataSet
{
get
{
- return new TheoryData
+ return new TheoryData
{
{
- new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0),
+ new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0),
null
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0),
offset: 10,
line: 11,
@@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Razor.Generator
null
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
@@ -98,24 +98,24 @@ namespace Microsoft.AspNet.Razor.Generator
new object()
},
{
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
col: 12),
- new AttributeBlockCodeGenerator(
+ new AttributeBlockChunkGenerator(
name: "Fred",
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15))
},
{
// Different Prefix.
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
col: 12),
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12),
offset: 10,
line: 11,
@@ -128,8 +128,8 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
public void Equals_True_WhenExpected(
- DynamicAttributeBlockCodeGenerator leftObject,
- DynamicAttributeBlockCodeGenerator rightObject)
+ DynamicAttributeBlockChunkGenerator leftObject,
+ DynamicAttributeBlockChunkGenerator rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -140,7 +140,7 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(NonMatchingTestDataSet))]
- public void Equals_False_WhenExpected(DynamicAttributeBlockCodeGenerator leftObject, object rightObject)
+ public void Equals_False_WhenExpected(DynamicAttributeBlockChunkGenerator leftObject, object rightObject)
{
// Arrange & Act
var result = leftObject.Equals(rightObject);
@@ -152,8 +152,8 @@ namespace Microsoft.AspNet.Razor.Generator
[Theory]
[MemberData(nameof(MatchingTestDataSet))]
public void GetHashCode_ReturnsSameValue_WhenEqual(
- DynamicAttributeBlockCodeGenerator leftObject,
- DynamicAttributeBlockCodeGenerator rightObject)
+ DynamicAttributeBlockChunkGenerator leftObject,
+ DynamicAttributeBlockChunkGenerator rightObject)
{
// Arrange & Act
var leftResult = leftObject.GetHashCode();
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs
similarity index 98%
rename from test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs
index adcd0db6d5..dc24749169 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs
@@ -1,7 +1,7 @@
// 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 Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.CodeGeneration;
using Xunit;
namespace Microsoft.AspNet.Razor.Test.Generator
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs
similarity index 95%
rename from test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs
index 672479889e..4ff127896f 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs
@@ -6,8 +6,8 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
+using Microsoft.AspNet.Razor.Chunks.Generators;
+using Microsoft.AspNet.Razor.CodeGeneration;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Utils;
using Microsoft.AspNet.Testing;
@@ -128,8 +128,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator
baselineName = name;
}
- var sourceLocation = string.Format("TestFiles/CodeGenerator/{1}/Source/{0}.{2}", name, LanguageName, FileExtension);
- var expectedOutput = TestFile.Create(string.Format("TestFiles/CodeGenerator/CS/Output/{0}.{1}", baselineName, BaselineExtension)).ReadAllText();
+ var sourceLocation = string.Format("TestFiles/CodeGenerator/Source/{0}.{1}", name, FileExtension);
+ var expectedOutput = TestFile.Create(string.Format("TestFiles/CodeGenerator/Output/{0}.{1}", baselineName, BaselineExtension)).ReadAllText();
// Set up the host and engine
var host = CreateHost();
@@ -176,7 +176,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
results = engine.GenerateCode(sourceFile, className: name, rootNamespace: TestRootNamespaceName, sourceFileName: sourceFileName);
}
// Only called if GENERATE_BASELINES is set, otherwise compiled out.
- BaselineWriter.WriteBaseline(string.Format(@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\{0}\Output\{1}.{2}", LanguageName, baselineName, BaselineExtension), results.GeneratedCode);
+ BaselineWriter.WriteBaseline(string.Format(@"test\Microsoft.AspNet.Razor.Test\TestFiles\ChunkGenerator\Output\{0}.{1}", baselineName, BaselineExtension), results.GeneratedCode);
#if !GENERATE_BASELINES
var textOutput = results.GeneratedCode;
diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs
new file mode 100644
index 0000000000..30f1df927a
--- /dev/null
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs
@@ -0,0 +1,92 @@
+// 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.Linq;
+using Microsoft.AspNet.Razor.TagHelpers;
+using Xunit;
+
+namespace Microsoft.AspNet.Razor.Chunks.Generators
+{
+ // Really tests underlying ParentChunkGenerator
+ public class RazorCommentChunkGeneratorTest
+ {
+ public static TheoryData MatchingTestDataSet
+ {
+ get
+ {
+ return new TheoryData
+ {
+ { new RazorCommentChunkGenerator(), new RazorCommentChunkGenerator() },
+ };
+ }
+ }
+
+ public static TheoryData NonMatchingTestDataSet
+ {
+ get
+ {
+ return new TheoryData
+ {
+ { new RazorCommentChunkGenerator(), null },
+ { new RazorCommentChunkGenerator(), new object() },
+ { new RazorCommentChunkGenerator(), ParentChunkGenerator.Null },
+ {
+ new RazorCommentChunkGenerator(),
+ new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null)
+ },
+ {
+ new RazorCommentChunkGenerator(),
+ new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0)
+ },
+ { new RazorCommentChunkGenerator(), new ExpressionChunkGenerator() },
+ { new RazorCommentChunkGenerator(), new SectionChunkGenerator(sectionName: null) },
+ {
+ new RazorCommentChunkGenerator(),
+ new TagHelperChunkGenerator(Enumerable.Empty())
+ },
+ { new RazorCommentChunkGenerator(), new TemplateBlockChunkGenerator() },
+ {
+ new RazorCommentChunkGenerator(),
+ new AddImportChunkGenerator(ns: "Fred")
+ },
+ };
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(MatchingTestDataSet))]
+ public void Equals_True_WhenExpected(RazorCommentChunkGenerator leftObject, IParentChunkGenerator rightObject)
+ {
+ // Arrange & Act
+ var result = leftObject.Equals(rightObject);
+
+ // Assert
+ Assert.True(result);
+ }
+
+ [Theory]
+ [MemberData(nameof(NonMatchingTestDataSet))]
+ public void Equals_False_WhenExpected(IParentChunkGenerator leftObject, object rightObject)
+ {
+ // Arrange & Act
+ var result = leftObject.Equals(rightObject);
+
+ // Assert
+ Assert.False(result);
+ }
+
+ [Theory]
+ [MemberData(nameof(MatchingTestDataSet))]
+ public void GetHashCode_ReturnsSameValue_WhenEqual(
+ RazorCommentChunkGenerator leftObject,
+ IParentChunkGenerator rightObject)
+ {
+ // Arrange & Act
+ var leftResult = leftObject.GetHashCode();
+ var rightResult = rightObject.GetHashCode();
+
+ // Assert
+ Assert.Equal(leftResult, rightResult);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TabTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs
similarity index 100%
rename from test/Microsoft.AspNet.Razor.Test/Generator/TabTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs
similarity index 88%
rename from test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs
index 07b64e0fd1..1a581d433e 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs
@@ -5,9 +5,8 @@ using System;
#if DNXCORE50
using System.Reflection;
#endif
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
-using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
+using Microsoft.AspNet.Razor.CodeGeneration;
+using Microsoft.AspNet.Razor.CodeGeneration.Visitors;
using Microsoft.AspNet.Razor.TagHelpers;
using Xunit;
@@ -16,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
public class TagHelperAttributeValueCodeRendererTest : TagHelperTestBase
{
[Fact]
- public void TagHelpers_CanReplaceAttributeCodeGeneratorLogic()
+ public void TagHelpers_CanReplaceAttributeChunkGeneratorLogic()
{
// Arrange
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
@@ -43,7 +42,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
// Act & Assert
RunTagHelperTest(testName: "BasicTagHelpers",
- baseLineName: "BasicTagHelpers.CustomAttributeCodeGenerator",
+ baseLineName: "BasicTagHelpers.CustomAttributeCodeBuilder",
tagHelperDescriptors: tagHelperDescriptors,
hostConfig: (host) =>
{
@@ -61,13 +60,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator
public override CodeBuilder DecorateCodeBuilder(CodeBuilder incomingBuilder, CodeBuilderContext context)
{
- return new AttributeCodeGeneratorReplacingCodeBuilder(context);
+ return new AttributeChunkGeneratorReplacingCodeBuilder(context);
}
}
- private class AttributeCodeGeneratorReplacingCodeBuilder : TestCSharpCodeBuilder
+ private class AttributeChunkGeneratorReplacingCodeBuilder : TestCSharpCodeBuilder
{
- public AttributeCodeGeneratorReplacingCodeBuilder(CodeBuilderContext context)
+ public AttributeChunkGeneratorReplacingCodeBuilder(CodeBuilderContext context)
: base(context)
{
}
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs
similarity index 96%
rename from test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs
index 60b60268da..4ce3802aab 100644
--- a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs
@@ -4,15 +4,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.AspNet.Razor.Generator;
-using Microsoft.AspNet.Razor.Generator.Compiler;
-using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
+using Microsoft.AspNet.Razor.CodeGeneration;
+using Microsoft.AspNet.Razor.CodeGeneration.Visitors;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.TagHelpers;
namespace Microsoft.AspNet.Razor.Test.Generator
{
- public class TagHelperTestBase : CSharpRazorCodeGeneratorTest
+ public class TagHelperTestBase : RazorCodeGeneratorTest
{
protected void RunTagHelperTest(string testName,
string baseLineName = null,
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TestSpan.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs
similarity index 100%
rename from test/Microsoft.AspNet.Razor.Test/Generator/TestSpan.cs
rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs
diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs
index e743fa2d91..8fee4c95c3 100644
--- a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers;
@@ -14,23 +14,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Statement;
- public StatementBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public StatementBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public StatementBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public StatementBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public StatementBlock(params SyntaxTreeNode[] children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
public StatementBlock(IEnumerable children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
}
@@ -39,23 +39,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Directive;
- public DirectiveBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public DirectiveBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public DirectiveBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public DirectiveBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public DirectiveBlock(params SyntaxTreeNode[] children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
public DirectiveBlock(IEnumerable children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
}
@@ -64,23 +64,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Functions;
- public FunctionsBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public FunctionsBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public FunctionsBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public FunctionsBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public FunctionsBlock(params SyntaxTreeNode[] children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
public FunctionsBlock(IEnumerable children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
}
@@ -89,23 +89,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Expression;
- public ExpressionBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public ExpressionBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public ExpressionBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public ExpressionBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public ExpressionBlock(params SyntaxTreeNode[] children)
- : this(new ExpressionCodeGenerator(), children)
+ : this(new ExpressionChunkGenerator(), children)
{
}
public ExpressionBlock(IEnumerable children)
- : this(new ExpressionCodeGenerator(), children)
+ : this(new ExpressionChunkGenerator(), children)
{
}
}
@@ -115,7 +115,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
private const BlockType ThisBlockType = BlockType.Tag;
public MarkupTagBlock(params SyntaxTreeNode[] children)
- : base(ThisBlockType, children, BlockCodeGenerator.Null)
+ : base(ThisBlockType, children, ParentChunkGenerator.Null)
{
}
}
@@ -124,28 +124,28 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Markup;
- public MarkupBlock(BlockType blockType, IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(blockType, children, codeGenerator)
+ public MarkupBlock(BlockType blockType, IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(blockType, children, chunkGenerator)
{
}
- public MarkupBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : this(ThisBlockType, codeGenerator, children)
+ public MarkupBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : this(ThisBlockType, chunkGenerator, children)
{
}
- public MarkupBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public MarkupBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public MarkupBlock(params SyntaxTreeNode[] children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
public MarkupBlock(IEnumerable children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
}
@@ -213,23 +213,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Section;
- public SectionBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public SectionBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public SectionBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public SectionBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public SectionBlock(params SyntaxTreeNode[] children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
public SectionBlock(IEnumerable children)
- : this(BlockCodeGenerator.Null, children)
+ : this(ParentChunkGenerator.Null, children)
{
}
}
@@ -238,23 +238,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Template;
- public TemplateBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public TemplateBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public TemplateBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public TemplateBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public TemplateBlock(params SyntaxTreeNode[] children)
- : this(new TemplateBlockCodeGenerator(), children)
+ : this(new TemplateBlockChunkGenerator(), children)
{
}
public TemplateBlock(IEnumerable children)
- : this(new TemplateBlockCodeGenerator(), children)
+ : this(new TemplateBlockChunkGenerator(), children)
{
}
}
@@ -263,23 +263,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
private const BlockType ThisBlockType = BlockType.Comment;
- public CommentBlock(IBlockCodeGenerator codeGenerator, IEnumerable children)
- : base(ThisBlockType, children, codeGenerator)
+ public CommentBlock(IParentChunkGenerator chunkGenerator, IEnumerable children)
+ : base(ThisBlockType, children, chunkGenerator)
{
}
- public CommentBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children)
- : this(codeGenerator, (IEnumerable)children)
+ public CommentBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children)
+ : this(chunkGenerator, (IEnumerable)children)
{
}
public CommentBlock(params SyntaxTreeNode[] children)
- : this(new RazorCommentCodeGenerator(), children)
+ : this(new RazorCommentChunkGenerator(), children)
{
}
public CommentBlock(IEnumerable children)
- : this(new RazorCommentCodeGenerator(), children)
+ : this(new RazorCommentChunkGenerator(), children)
{
}
}
diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs b/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs
index 8c0f89a323..a3d8ddd1fc 100644
--- a/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers;
@@ -360,7 +360,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
private static void EvaluateBlock(ErrorCollector collector, Block actual, Block expected)
{
- if (actual.Type != expected.Type || !expected.CodeGenerator.Equals(actual.CodeGenerator))
+ if (actual.Type != expected.Type || !expected.ChunkGenerator.Equals(actual.ChunkGenerator))
{
AddMismatchError(collector, actual, expected);
}
@@ -516,14 +516,14 @@ namespace Microsoft.AspNet.Razor.Test.Framework
switch (block.Type)
{
case BlockType.Markup:
- span.With(new MarkupCodeGenerator());
+ span.With(new MarkupChunkGenerator());
break;
case BlockType.Statement:
- span.With(new StatementCodeGenerator());
+ span.With(new StatementChunkGenerator());
break;
case BlockType.Expression:
- block.CodeGenerator = new ExpressionCodeGenerator();
- span.With(new ExpressionCodeGenerator());
+ block.ChunkGenerator = new ExpressionChunkGenerator();
+ span.With(new ExpressionChunkGenerator());
break;
}
block.Children.Add(span);
diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs
index 4446ade9df..1d01af7f05 100644
--- a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Razor.Editor;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
@@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
public static SpanConstructor EmptyHtml(this SpanFactory self)
{
return self.Span(SpanKind.Markup, new HtmlSymbol(self.LocationTracker.CurrentLocation, string.Empty, HtmlSymbolType.Unknown))
- .With(new MarkupCodeGenerator());
+ .With(new MarkupChunkGenerator());
}
public static UnclassifiedCodeSpanConstructor Code(this SpanFactory self, string content)
@@ -108,23 +108,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
return self
.Span(SpanKind.MetaCode, "!", markup: true)
- .With(SpanCodeGenerator.Null)
+ .With(SpanChunkGenerator.Null)
.Accepts(AcceptedCharacters.None);
}
public static SpanConstructor Markup(this SpanFactory self, string content)
{
- return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupCodeGenerator());
+ return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupChunkGenerator());
}
public static SpanConstructor Markup(this SpanFactory self, params string[] content)
{
- return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupCodeGenerator());
+ return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupChunkGenerator());
}
public static SpanConstructor CodeMarkup(this SpanFactory self, params string[] content)
{
- return self.Span(SpanKind.Code, content, markup: true).With(new MarkupCodeGenerator());
+ return self.Span(SpanKind.Code, content, markup: true).With(new MarkupChunkGenerator());
}
public static SourceLocation GetLocationAndAdvance(this SourceLocationTracker self, string content)
@@ -274,12 +274,12 @@ namespace Microsoft.AspNet.Razor.Test.Framework
public SpanConstructor AsStatement()
{
- return _self.With(new StatementCodeGenerator());
+ return _self.With(new StatementChunkGenerator());
}
public SpanConstructor AsExpression()
{
- return _self.With(new ExpressionCodeGenerator());
+ return _self.With(new ExpressionChunkGenerator());
}
public SpanConstructor AsImplicitExpression(ISet keywords)
@@ -290,28 +290,28 @@ namespace Microsoft.AspNet.Razor.Test.Framework
public SpanConstructor AsImplicitExpression(ISet keywords, bool acceptTrailingDot)
{
return _self.With(new ImplicitExpressionEditHandler(SpanConstructor.TestTokenizer, keywords, acceptTrailingDot))
- .With(new ExpressionCodeGenerator());
+ .With(new ExpressionChunkGenerator());
}
public SpanConstructor AsFunctionsBody()
{
- return _self.With(new TypeMemberCodeGenerator());
+ return _self.With(new TypeMemberChunkGenerator());
}
public SpanConstructor AsNamespaceImport(string ns)
{
- return _self.With(new AddImportCodeGenerator(ns));
+ return _self.With(new AddImportChunkGenerator(ns));
}
public SpanConstructor Hidden()
{
- return _self.With(SpanCodeGenerator.Null);
+ return _self.With(SpanChunkGenerator.Null);
}
public SpanConstructor AsBaseType(string baseType)
{
return _self
- .With(new SetBaseTypeCodeGenerator(baseType))
+ .With(new SetBaseTypeChunkGenerator(baseType))
.Accepts(AcceptedCharacters.AnyExceptNewline);
}
@@ -319,27 +319,27 @@ namespace Microsoft.AspNet.Razor.Test.Framework
{
return _self
.With(
- new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: false, lookupText: lookupText))
+ new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: false, lookupText: lookupText))
.Accepts(AcceptedCharacters.AnyExceptNewline);
}
public SpanConstructor AsRemoveTagHelper(string lookupText)
{
return _self
- .With(new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: true, lookupText: lookupText))
+ .With(new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: true, lookupText: lookupText))
.Accepts(AcceptedCharacters.AnyExceptNewline);
}
public SpanConstructor AsTagHelperPrefixDirective(string prefix)
{
return _self
- .With(new TagHelperPrefixDirectiveCodeGenerator(prefix))
+ .With(new TagHelperPrefixDirectiveChunkGenerator(prefix))
.Accepts(AcceptedCharacters.AnyExceptNewline);
}
- public SpanConstructor As(ISpanCodeGenerator codeGenerator)
+ public SpanConstructor As(ISpanChunkGenerator chunkGenerator)
{
- return _self.With(codeGenerator);
+ return _self.With(chunkGenerator);
}
}
@@ -368,9 +368,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework
return Builder.Build();
}
- public SpanConstructor With(ISpanCodeGenerator generator)
+ public SpanConstructor With(ISpanChunkGenerator generator)
{
- Builder.CodeGenerator = generator;
+ Builder.ChunkGenerator = generator;
return this;
}
@@ -380,9 +380,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework
return this;
}
- public SpanConstructor With(Action generatorConfigurer)
+ public SpanConstructor With(Action generatorConfigurer)
{
- generatorConfigurer(Builder.CodeGenerator);
+ generatorConfigurer(Builder.ChunkGenerator);
return this;
}
@@ -399,7 +399,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
public SpanConstructor Hidden()
{
- Builder.CodeGenerator = SpanCodeGenerator.Null;
+ Builder.ChunkGenerator = SpanChunkGenerator.Null;
return this;
}
}
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs b/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs
deleted file mode 100644
index e045301571..0000000000
--- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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 Xunit;
-
-namespace Microsoft.AspNet.Razor.Test.Generator
-{
- public class CodeTreeGenerationTest : CSharpRazorCodeGeneratorTest
- {
- [Fact]
- public void CodeTreeComparisonTest()
- {
- RunTest("CodeTree", onResults: (results) =>
- {
- }, designTimeMode: true);
- }
- }
-}
diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs
deleted file mode 100644
index 814fd04f4a..0000000000
--- a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.Linq;
-using Microsoft.AspNet.Razor.TagHelpers;
-using Xunit;
-
-namespace Microsoft.AspNet.Razor.Generator
-{
- // Really tests underlying BlockCodeGenerator
- public class RazorCommentCodeGeneratorTest
- {
- public static TheoryData MatchingTestDataSet
- {
- get
- {
- return new TheoryData
- {
- { new RazorCommentCodeGenerator(), new RazorCommentCodeGenerator() },
- };
- }
- }
-
- public static TheoryData NonMatchingTestDataSet
- {
- get
- {
- return new TheoryData
- {
- { new RazorCommentCodeGenerator(), null },
- { new RazorCommentCodeGenerator(), new object() },
- { new RazorCommentCodeGenerator(), BlockCodeGenerator.Null },
- {
- new RazorCommentCodeGenerator(),
- new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null)
- },
- {
- new RazorCommentCodeGenerator(),
- new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0)
- },
- { new RazorCommentCodeGenerator(), new ExpressionCodeGenerator() },
- { new RazorCommentCodeGenerator(), new SectionCodeGenerator(sectionName: null) },
- {
- new RazorCommentCodeGenerator(),
- new TagHelperCodeGenerator(Enumerable.Empty())
- },
- { new RazorCommentCodeGenerator(), new TemplateBlockCodeGenerator() },
- {
- new RazorCommentCodeGenerator(),
- new AddImportCodeGenerator(ns: "Fred")
- },
- };
- }
- }
-
- [Theory]
- [MemberData(nameof(MatchingTestDataSet))]
- public void Equals_True_WhenExpected(RazorCommentCodeGenerator leftObject, IBlockCodeGenerator rightObject)
- {
- // Arrange & Act
- var result = leftObject.Equals(rightObject);
-
- // Assert
- Assert.True(result);
- }
-
- [Theory]
- [MemberData(nameof(NonMatchingTestDataSet))]
- public void Equals_False_WhenExpected(IBlockCodeGenerator leftObject, object rightObject)
- {
- // Arrange & Act
- var result = leftObject.Equals(rightObject);
-
- // Assert
- Assert.False(result);
- }
-
- [Theory]
- [MemberData(nameof(MatchingTestDataSet))]
- public void GetHashCode_ReturnsSameValue_WhenEqual(
- RazorCommentCodeGenerator leftObject,
- IBlockCodeGenerator rightObject)
- {
- // Arrange & Act
- var leftResult = leftObject.GetHashCode();
- var rightResult = rightObject.GetHashCode();
-
- // Assert
- Assert.Equal(leftResult, rightResult);
- }
- }
-}
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs
index 56550ce1f3..bf065b2d6a 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Web.WebPages.TestUtils;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text;
@@ -29,21 +29,21 @@ namespace Microsoft.AspNet.Razor.Test.Parser
}
[Fact]
- public void ConstructorTransfersInstanceOfCodeGeneratorFromBlockBuilder()
+ public void ConstructorTransfersInstanceOfChunkGeneratorFromBlockBuilder()
{
// Arrange
- var expected = new ExpressionCodeGenerator();
+ var expected = new ExpressionChunkGenerator();
var builder = new BlockBuilder()
{
Type = BlockType.Helper,
- CodeGenerator = expected
+ ChunkGenerator = expected
};
// Act
var actual = builder.Build();
// Assert
- Assert.Same(expected, actual.CodeGenerator);
+ Assert.Same(expected, actual.ChunkGenerator);
}
[Fact]
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs
index c579a2ce6a..9705cd37f4 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
public void SectionDirectiveAutoCompleteAtEOF()
{
ParseBlockTest("@section Header {",
- new SectionBlock(new SectionCodeGenerator("Header"),
+ new SectionBlock(new SectionChunkGenerator("Header"),
Factory.CodeTransition(),
Factory.MetaCode("section Header {")
.AutoCompleteWith("}", atEndOfSpan: true)
@@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{
ParseBlockTest("@section Header {" + Environment.NewLine
+ "Foo
",
- new SectionBlock(new SectionCodeGenerator("Header"),
+ new SectionBlock(new SectionChunkGenerator("Header"),
Factory.CodeTransition(),
Factory.MetaCode("section Header {")
.AutoCompleteWith("}", atEndOfSpan: true)
@@ -120,7 +120,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
new MarkupTagBlock(
Factory.Markup("
").Accepts(AcceptedCharacters.None))),
Factory.Span(SpanKind.Code, new CSharpSymbol(Factory.LocationTracker.CurrentLocation, string.Empty, CSharpSymbolType.Unknown))
- .With(new StatementCodeGenerator())
+ .With(new StatementChunkGenerator())
),
new RazorError(RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
1, 0, 1));
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs
index 5640a9d137..6aa62d5fea 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -704,20 +704,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
Factory.Markup("(" href=\"", 183 + Environment.NewLine.Length * 5, 5, 30),
new LocationTagged("\"", 246 + Environment.NewLine.Length * 5, 5, 93)),
- Factory.Markup(" href=\"").With(SpanCodeGenerator.Null),
+ Factory.Markup(" href=\"").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(
+ new DynamicAttributeBlockChunkGenerator(
new LocationTagged(string.Empty, 190 + Environment.NewLine.Length * 5, 5, 37), 190 + Environment.NewLine.Length * 5, 5, 37),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.Code("Html.ActionUrl(\"Products\", \"Detail\", new { id = p.Id })")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("\"").With(SpanCodeGenerator.Null)),
+ Factory.Markup("\"").With(SpanChunkGenerator.Null)),
Factory.Markup(">").Accepts(AcceptedCharacters.None)),
Factory.EmptyHtml(),
new ExpressionBlock(
@@ -758,12 +758,12 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 14, 0, 14)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 14, 0, 14)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -774,13 +774,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
- factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
+ factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -791,13 +791,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("def").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("def", 14, 0, 14))),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("def").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("def", 14, 0, 14))),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -808,14 +808,14 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 22, 0, 22)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
- factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 22, 0, 22)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
+ factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
new MarkupBlock(
- factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 15, 0, 15), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup(" def").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 18, 0, 18), new LocationTagged("def", 19, 0, 19))),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 15, 0, 15), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup(" def").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 18, 0, 18), new LocationTagged("def", 19, 0, 19))),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -826,16 +826,16 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14),
- factory.EmptyHtml().With(SpanCodeGenerator.Null),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14),
+ factory.EmptyHtml().With(SpanChunkGenerator.Null),
datetimeBlock),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -845,15 +845,15 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 28, 0, 28)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 28, 0, 28)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
datetimeBlock),
new MarkupBlock(
- factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 25, 0, 25), new LocationTagged("@", 26, 0, 26))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 25, 0, 25), new LocationTagged("@", 26, 0, 26))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -863,15 +863,15 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
datetimeBlock),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 25, 0, 25), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 25, 0, 25), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -881,23 +881,23 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 33, 0, 33)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 33, 0, 33)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
new ExpressionBlock(
factory.CodeTransition(),
- factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None),
+ factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None),
factory.Code("2+3").AsExpression(),
- factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))),
+ factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("@", 18, 0, 18))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("@", 18, 0, 18))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 20, 0, 20), 20, 0, 20),
- factory.EmptyHtml().With(SpanCodeGenerator.Null),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 20, 0, 20), 20, 0, 20),
+ factory.EmptyHtml().With(SpanChunkGenerator.Null),
datetimeBlock),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -907,20 +907,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 20, 0, 20)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 20, 0, 20)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14),
- factory.EmptyHtml().With(SpanCodeGenerator.Null),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14),
+ factory.EmptyHtml().With(SpanChunkGenerator.Null),
new ExpressionBlock(
factory.CodeTransition(),
- factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None),
+ factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None),
factory.Code("2+3").AsExpression(),
- factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -931,13 +931,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 26, 0, 26)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
- factory.Markup("abc@def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc@def.com", 12, 0, 12))),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 26, 0, 26)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
+ factory.Markup("abc@def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc@def.com", 12, 0, 12))),
new MarkupBlock(
- factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -947,17 +947,17 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
- factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
+ factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("def.com", 17, 0, 17))),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("def.com", 17, 0, 17))),
new MarkupBlock(
- factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
{
@@ -968,14 +968,14 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
factory.Markup("(" foo=\"", 6, 0, 6), new LocationTagged("\"", 112, 0, 112)),
- factory.Markup(" foo=\"").With(SpanCodeGenerator.Null),
- factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 12, 0, 12))),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo=\"", 6, 0, 6), new LocationTagged("\"", 112, 0, 112)),
+ factory.Markup(" foo=\"").With(SpanChunkGenerator.Null),
+ factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 12, 0, 12))),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 44, 0, 44), new LocationTagged("@", 44, 0, 44))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 46, 0, 46), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 46, 0, 46))),
- factory.Markup("\"").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 44, 0, 44), new LocationTagged("@", 44, 0, 44))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 46, 0, 46), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 46, 0, 46))),
+ factory.Markup("\"").With(SpanChunkGenerator.Null)),
factory.Markup(" />").Accepts(AcceptedCharacters.None))))
},
};
@@ -1000,11 +1000,11 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
Factory.Markup("(" foo='", 6, 0, 6), new LocationTagged(string.Empty, 14, 0, 14)),
- Factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged(string.Empty, 14, 0, 14)),
+ Factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- Factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
- Factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)))),
+ Factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None),
+ Factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)))),
Factory.EmptyHtml()));
var expectedErrors = new RazorError[]
{
@@ -1026,20 +1026,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
new MarkupTagBlock(
Factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 15, 0, 15)),
- Factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 15, 0, 15)),
+ Factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(" ", 13, 0, 13), 13, 0, 13),
- Factory.Markup(" ").With(SpanCodeGenerator.Null),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(" ", 13, 0, 13), 13, 0, 13),
+ Factory.Markup(" ").With(SpanChunkGenerator.Null),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("'").With(SpanCodeGenerator.Null)),
+ Factory.Markup("'").With(SpanChunkGenerator.Null)),
Factory.Markup(" />").Accepts(AcceptedCharacters.None))),
Factory.EmptyCSharp().AsStatement(),
Factory.MetaCode("}").Accepts(AcceptedCharacters.None));
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs
index f323c36f27..ac25e18729 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs
@@ -1,7 +1,7 @@
// 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 Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -402,7 +402,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
public void SectionDirective()
{
ParseBlockTest("@section Header { F{o}o
}",
- new SectionBlock(new SectionCodeGenerator("Header"),
+ new SectionBlock(new SectionChunkGenerator("Header"),
Factory.CodeTransition(),
Factory.MetaCode("section Header {")
.AutoCompleteWith(null, atEndOfSpan: true)
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs
index 2c8f9754dc..3959cf2540 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section" + Environment.NewLine,
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator(string.Empty),
+ new SectionBlock(new SectionChunkGenerator(string.Empty),
Factory.CodeTransition(),
Factory.MetaCode("section" + Environment.NewLine))),
new RazorError(
@@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ " ",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("Foo"),
+ new SectionBlock(new SectionChunkGenerator("Foo"),
Factory.CodeTransition(),
Factory.MetaCode("section Foo " + Environment.NewLine)),
Factory.Markup(" ")),
@@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ " ",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator(string.Empty),
+ new SectionBlock(new SectionChunkGenerator(string.Empty),
Factory.CodeTransition(),
Factory.MetaCode("section " + Environment.NewLine)),
Factory.Markup(" ")),
@@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section 9 { Foo
}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator(string.Empty),
+ new SectionBlock(new SectionChunkGenerator(string.Empty),
Factory.CodeTransition(),
Factory.MetaCode("section ")),
Factory.Markup("9 { "),
@@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo-bar { Foo
}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo")),
Factory.Markup("-bar { "),
@@ -118,13 +118,13 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo { @section bar { Foo
} }",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
new MarkupBlock(
Factory.Markup(" "),
- new SectionBlock(new SectionCodeGenerator("bar"),
+ new SectionBlock(new SectionChunkGenerator("bar"),
Factory.CodeTransition(),
Factory.MetaCode("section bar {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo {",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith("}", atEndOfSpan: true),
@@ -168,7 +168,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo { Foo{}
",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith("}", atEndOfSpan: true),
@@ -191,7 +191,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo " + Environment.NewLine,
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo " + Environment.NewLine))),
new RazorError(RazorResources.ParseError_MissingOpenBraceAfterSection, 12, 0, 12));
@@ -211,7 +211,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode(string.Format("section foo {0}{0}{0}{0}{0}{0}{{", Environment.NewLine))
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -233,7 +233,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo { Foo
}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -255,7 +255,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo{ Foo
}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo{")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -277,7 +277,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo { }",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -299,7 +299,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo { I really want to render a close brace, so here I go: @(\"}\") }",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -324,7 +324,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("Foo"),
+ new SectionBlock(new SectionChunkGenerator("Foo"),
Factory.CodeTransition(),
Factory.MetaCode("section Foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -346,7 +346,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ "}}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("Foo"),
+ new SectionBlock(new SectionChunkGenerator("Foo"),
Factory.CodeTransition(),
Factory.MetaCode("section Foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -366,7 +366,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section foo {something}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("foo"),
+ new SectionBlock(new SectionChunkGenerator("foo"),
Factory.CodeTransition(),
Factory.MetaCode("section foo {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -382,7 +382,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section s {}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
Factory.CodeTransition(),
Factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -400,7 +400,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ParseDocumentTest("@section s {}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
Factory.CodeTransition(),
Factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -417,7 +417,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
"@section s {" + Environment.NewLine + " \" '-->}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
Factory.CodeTransition(),
Factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -437,7 +437,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
"@section s { xml bleh ?>}",
new MarkupBlock(
Factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
Factory.CodeTransition(),
Factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -459,7 +459,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
"@section s {}",
new MarkupBlock(
factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
factory.CodeTransition(),
factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -467,12 +467,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
new MarkupTagBlock(
factory.Markup("(" foo='", 17, 0, 17), new LocationTagged("'", 25, 0, 25)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 17, 0, 17), new LocationTagged("'", 25, 0, 25)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 23, 0, 23), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 23, 0, 23), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />"))),
factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
factory.EmptyHtml())
@@ -481,7 +481,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
"@section s {}",
new MarkupBlock(
factory.EmptyHtml(),
- new SectionBlock(new SectionCodeGenerator("s"),
+ new SectionBlock(new SectionChunkGenerator("s"),
factory.CodeTransition(),
factory.MetaCode("section s {")
.AutoCompleteWith(null, atEndOfSpan: true),
@@ -489,19 +489,19 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
new MarkupTagBlock(
factory.Markup("(" foo='", 17, 0, 17), new LocationTagged("'", 39, 0, 39)),
- factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 17, 0, 17), new LocationTagged("'", 39, 0, 39)),
+ factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 23, 0, 23), 23, 0, 23),
+ new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 23, 0, 23), 23, 0, 23),
new ExpressionBlock(
factory.CodeTransition(),
factory.Code("DateTime.Now")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace))),
new MarkupBlock(
- factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 36, 0, 36), new LocationTagged("@", 37, 0, 37))).Accepts(AcceptedCharacters.None),
- factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- factory.Markup("'").With(SpanCodeGenerator.Null)),
+ factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 36, 0, 36), new LocationTagged("@", 37, 0, 37))).Accepts(AcceptedCharacters.None),
+ factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)),
+ factory.Markup("'").With(SpanChunkGenerator.Null)),
factory.Markup(" />"))),
factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
factory.EmptyHtml())
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs
index e46b76850d..bbf4494d50 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -248,7 +248,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
public void NonBlockKeywordTreatedAsImplicitExpression()
{
ParseBlockTest("@is foo",
- new ExpressionBlock(new ExpressionCodeGenerator(),
+ new ExpressionBlock(new ExpressionChunkGenerator(),
Factory.CodeTransition(),
Factory.Code("is")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs
index 95d2ed8d98..30159d5836 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs
@@ -3,7 +3,7 @@
using System;
using Microsoft.AspNet.Razor.Editor;
-using Microsoft.AspNet.Razor.Generator;
+using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
@@ -285,12 +285,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
new MarkupTagBlock(
Factory.Markup("(" foo='", 46, 0, 46), new LocationTagged("'", 54, 0, 54)),
- Factory.Markup(" foo='").With(SpanCodeGenerator.Null),
+ new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 46, 0, 46), new LocationTagged("'", 54, 0, 54)),
+ Factory.Markup(" foo='").With(SpanChunkGenerator.Null),
new MarkupBlock(
- Factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 52, 0, 52), new LocationTagged("@", 52, 0, 52))).Accepts(AcceptedCharacters.None),
- Factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)),
- Factory.Markup("'").With(SpanCodeGenerator.Null)),
+ Factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 52, 0, 52), new LocationTagged