Update names and spacing of some missed ChunkTree renames.

This commit is contained in:
N. Taylor Mullen 2015-05-29 23:07:55 -07:00
parent 951a1d0879
commit e0b8532735
4 changed files with 19 additions and 18 deletions

View File

@ -49,9 +49,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives
{ {
// If there's more than 1 model chunk there will be a Razor error BUT we want intellisense to show up on // If there's more than 1 model chunk there will be a Razor error BUT we want intellisense to show up on
// the current model chunk that the user is typing. // the current model chunk that the user is typing.
return chunkTree.Chunks return chunkTree
.OfType<ModelChunk>() .Chunks
.LastOrDefault(); .OfType<ModelChunk>()
.LastOrDefault();
} }
/// <summary> /// <summary>

View File

@ -45,12 +45,12 @@ namespace Microsoft.AspNet.Mvc.Razor
private readonly RazorPathNormalizer _pathNormalizer; private readonly RazorPathNormalizer _pathNormalizer;
private ChunkInheritanceUtility _chunkInheritanceUtility; private ChunkInheritanceUtility _chunkInheritanceUtility;
internal MvcRazorHost(IChunkTreeCache ChunkTreeCache, RazorPathNormalizer pathNormalizer) internal MvcRazorHost(IChunkTreeCache chunkTreeCache, RazorPathNormalizer pathNormalizer)
: base(new CSharpRazorCodeLanguage()) : base(new CSharpRazorCodeLanguage())
{ {
_pathNormalizer = pathNormalizer; _pathNormalizer = pathNormalizer;
_baseType = BaseType; _baseType = BaseType;
_chunkTreeCache = ChunkTreeCache; _chunkTreeCache = chunkTreeCache;
TagHelperDescriptorResolver = new TagHelperDescriptorResolver(); TagHelperDescriptorResolver = new TagHelperDescriptorResolver();
DefaultBaseClass = BaseType + "<" + DefaultModel + ">"; DefaultBaseClass = BaseType + "<" + DefaultModel + ">";
@ -124,11 +124,11 @@ namespace Microsoft.AspNet.Mvc.Razor
} }
#endif #endif
/// <summary> /// <summary>
/// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="ChunkTreeCache"/>. /// Initializes a new instance of <see cref="MvcRazorHost"/> using the specified <paramref name="chunkTreeCache"/>.
/// </summary> /// </summary>
/// <param name="ChunkTreeCache">An <see cref="IChunkTreeCache"/> rooted at the application base path.</param> /// <param name="chunkTreeCache">An <see cref="IChunkTreeCache"/> rooted at the application base path.</param>
public MvcRazorHost(IChunkTreeCache ChunkTreeCache) public MvcRazorHost(IChunkTreeCache chunkTreeCache)
: this(ChunkTreeCache, new RazorPathNormalizer()) : this(chunkTreeCache, new RazorPathNormalizer())
{ {
} }

View File

@ -39,10 +39,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives
// Assert // Assert
Assert.Collection(chunkTrees, Assert.Collection(chunkTrees,
ChunkTree => chunkTree =>
{ {
var viewImportsPath = @"Views\home\_ViewImports.cshtml"; var viewImportsPath = @"Views\home\_ViewImports.cshtml";
Assert.Collection(ChunkTree.Chunks, Assert.Collection(chunkTree.Chunks,
chunk => chunk =>
{ {
Assert.IsType<LiteralChunk>(chunk); Assert.IsType<LiteralChunk>(chunk);
@ -60,10 +60,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives
Assert.Equal(viewImportsPath, chunk.Start.FilePath); Assert.Equal(viewImportsPath, chunk.Start.FilePath);
}); });
}, },
ChunkTree => chunkTree =>
{ {
var viewImportsPath = @"Views\_ViewImports.cshtml"; var viewImportsPath = @"Views\_ViewImports.cshtml";
Assert.Collection(ChunkTree.Chunks, Assert.Collection(chunkTree.Chunks,
chunk => chunk =>
{ {
Assert.IsType<LiteralChunk>(chunk); Assert.IsType<LiteralChunk>(chunk);

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc.Razor
var rootedAppPath = $"{rootPrefix}SomeComputer/Location/Project/"; var rootedAppPath = $"{rootPrefix}SomeComputer/Location/Project/";
var rootedFilePath = $"{rootPrefix}SomeComputer/Location/Project/src/file.cshtml"; var rootedFilePath = $"{rootPrefix}SomeComputer/Location/Project/src/file.cshtml";
var host = new MvcRazorHost( var host = new MvcRazorHost(
ChunkTreeCache: null, chunkTreeCache: null,
pathNormalizer: new DesignTimeRazorPathNormalizer(rootedAppPath)); pathNormalizer: new DesignTimeRazorPathNormalizer(rootedAppPath));
var parser = new RazorParser( var parser = new RazorParser(
host.CodeLanguage.CreateCodeParser(), host.CodeLanguage.CreateCodeParser(),
@ -59,10 +59,10 @@ namespace Microsoft.AspNet.Mvc.Razor
var rootedAppPath = $"{rootPrefix}SomeComputer/Location/Project/"; var rootedAppPath = $"{rootPrefix}SomeComputer/Location/Project/";
var rootedFilePath = $"{rootPrefix}SomeComputer/Location/Project/src/file.cshtml"; var rootedFilePath = $"{rootPrefix}SomeComputer/Location/Project/src/file.cshtml";
var host = new MvcRazorHost( var host = new MvcRazorHost(
ChunkTreeCache: null, chunkTreeCache: null,
pathNormalizer: new DesignTimeRazorPathNormalizer(rootedAppPath)); pathNormalizer: new DesignTimeRazorPathNormalizer(rootedAppPath));
var chunkInheritanceUtility = new PathValidatingChunkInheritanceUtility(host); var chunkInheritanceUtility = new PathValidatingChunkInheritanceUtility(host);
var CodeGeneratorContext = new CodeGeneratorContext( var codeGeneratorContext = new CodeGeneratorContext(
new ChunkGeneratorContext( new ChunkGeneratorContext(
host, host,
host.DefaultClassName, host.DefaultClassName,
@ -70,11 +70,11 @@ namespace Microsoft.AspNet.Mvc.Razor
rootedFilePath, rootedFilePath,
shouldGenerateLinePragmas: true), shouldGenerateLinePragmas: true),
new ErrorSink()); new ErrorSink());
var codeGenerator = new CSharpCodeGenerator(CodeGeneratorContext); var codeGenerator = new CSharpCodeGenerator(codeGeneratorContext);
host.ChunkInheritanceUtility = chunkInheritanceUtility; host.ChunkInheritanceUtility = chunkInheritanceUtility;
// Act // Act
host.DecorateCodeGenerator(codeGenerator, CodeGeneratorContext); host.DecorateCodeGenerator(codeGenerator, codeGeneratorContext);
// Assert // Assert
Assert.Equal("src/file.cshtml", chunkInheritanceUtility.InheritedChunkTreePagePath, StringComparer.Ordinal); Assert.Equal("src/file.cshtml", chunkInheritanceUtility.InheritedChunkTreePagePath, StringComparer.Ordinal);