Merge branch 'release/2.1' into release/2.2

This commit is contained in:
Ajay Bhargav Baaskaran 2019-01-16 14:51:49 -08:00
commit 4c1a375a2c
2 changed files with 45 additions and 46 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -63,16 +64,16 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.Equal(new string[] Assert.Equal(new string[]
{ {
"/Views/_ViewImports.cshtml",
"/Views/_ViewStart.cshtml",
"/Views/Home/About.cshtml", "/Views/Home/About.cshtml",
"/Views/Home/Contact.cshtml", "/Views/Home/Contact.cshtml",
"/Views/Home/Index.cshtml", "/Views/Home/Index.cshtml",
"/Views/Shared/Error.cshtml",
"/Views/Shared/_Layout.cshtml", "/Views/Shared/_Layout.cshtml",
"/Views/Shared/_ValidationScriptsPartial.cshtml", "/Views/Shared/_ValidationScriptsPartial.cshtml",
"/Views/Shared/Error.cshtml", "/Views/_ViewImports.cshtml",
"/Views/_ViewStart.cshtml",
}, },
resources.OrderBy(r => r)); resources.OrderBy(r => r, StringComparer.Ordinal));
} }
[Fact] [Fact]
@ -90,16 +91,16 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.Equal(new string[] Assert.Equal(new string[]
{ {
"/Views/_ViewImports.cshtml",
"/Views/_ViewStart.cshtml",
"/Views/Home/About.cshtml", "/Views/Home/About.cshtml",
"/Views/Home/Contact.cshtml", "/Views/Home/Contact.cshtml",
"/Views/Home/Index.cshtml", "/Views/Home/Index.cshtml",
"/Views/Shared/Error.cshtml",
"/Views/Shared/_Layout.cshtml", "/Views/Shared/_Layout.cshtml",
"/Views/Shared/_ValidationScriptsPartial.cshtml", "/Views/Shared/_ValidationScriptsPartial.cshtml",
"/Views/Shared/Error.cshtml", "/Views/_ViewImports.cshtml",
"/Views/_ViewStart.cshtml",
}, },
resources.OrderBy(r => r)); resources.OrderBy(r => r, StringComparer.Ordinal));
} }
private Assembly LoadAssemblyFromBytes(params string[] paths) private Assembly LoadAssemblyFromBytes(params string[] paths)

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
@ -77,15 +78,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.Collection( Assert.Collection(
items.OrderBy(f => f.FilePath), items.OrderBy(f => f.FilePath, StringComparer.Ordinal),
item =>
{
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal("_ViewImports.cshtml", item.RelativePhysicalPath);
},
item => item =>
{ {
Assert.Equal("/Home.cshtml", item.FilePath); Assert.Equal("/Home.cshtml", item.FilePath);
@ -93,14 +86,6 @@ namespace Microsoft.AspNetCore.Razor.Language
Assert.Equal(Path.Combine(TestFolder, "Home.cshtml"), item.PhysicalPath); Assert.Equal(Path.Combine(TestFolder, "Home.cshtml"), item.PhysicalPath);
Assert.Equal("Home.cshtml", item.RelativePhysicalPath); Assert.Equal("Home.cshtml", item.RelativePhysicalPath);
},
item =>
{
Assert.Equal("/Views/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Views", "_ViewImports.cshtml"), item.RelativePhysicalPath);
}, },
item => item =>
{ {
@ -110,19 +95,32 @@ namespace Microsoft.AspNetCore.Razor.Language
Assert.Equal(Path.Combine("Views", "About", "About.cshtml"), item.RelativePhysicalPath); Assert.Equal(Path.Combine("Views", "About", "About.cshtml"), item.RelativePhysicalPath);
}, },
item => item =>
{
Assert.Equal("/Views/Home/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Views", "Home", "_ViewImports.cshtml"), item.RelativePhysicalPath);
},
item =>
{ {
Assert.Equal("/Views/Home/Index.cshtml", item.FilePath); Assert.Equal("/Views/Home/Index.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath); Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath); Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Views", "Home", "Index.cshtml"), item.RelativePhysicalPath); Assert.Equal(Path.Combine("Views", "Home", "Index.cshtml"), item.RelativePhysicalPath);
},
item =>
{
Assert.Equal("/Views/Home/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Views", "Home", "_ViewImports.cshtml"), item.RelativePhysicalPath);
},
item =>
{
Assert.Equal("/Views/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Views", "_ViewImports.cshtml"), item.RelativePhysicalPath);
},
item =>
{
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal("_ViewImports.cshtml", item.RelativePhysicalPath);
}); });
} }
@ -137,14 +135,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// Assert // Assert
Assert.Collection( Assert.Collection(
items.OrderBy(f => f.FilePath), items.OrderBy(f => f.FilePath, StringComparer.Ordinal),
item =>
{
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/Views", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("_ViewImports.cshtml"), item.RelativePhysicalPath);
},
item => item =>
{ {
Assert.Equal("/About/About.cshtml", item.FilePath); Assert.Equal("/About/About.cshtml", item.FilePath);
@ -153,6 +144,13 @@ namespace Microsoft.AspNetCore.Razor.Language
Assert.Equal(Path.Combine("About", "About.cshtml"), item.RelativePhysicalPath); Assert.Equal(Path.Combine("About", "About.cshtml"), item.RelativePhysicalPath);
}, },
item => item =>
{
Assert.Equal("/Home/Index.cshtml", item.FilePath);
Assert.Equal("/Views", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Home", "Index.cshtml"), item.RelativePhysicalPath);
},
item =>
{ {
Assert.Equal("/Home/_ViewImports.cshtml", item.FilePath); Assert.Equal("/Home/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/Views", item.BasePath); Assert.Equal("/Views", item.BasePath);
@ -161,10 +159,10 @@ namespace Microsoft.AspNetCore.Razor.Language
}, },
item => item =>
{ {
Assert.Equal("/Home/Index.cshtml", item.FilePath); Assert.Equal("/_ViewImports.cshtml", item.FilePath);
Assert.Equal("/Views", item.BasePath); Assert.Equal("/Views", item.BasePath);
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath); Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
Assert.Equal(Path.Combine("Home", "Index.cshtml"), item.RelativePhysicalPath); Assert.Equal(Path.Combine("_ViewImports.cshtml"), item.RelativePhysicalPath);
}); });
} }