Skip to content

Commit 4c1a375

Browse files
committed
Merge branch 'release/2.1' into release/2.2
2 parents 18425ed + ad31f94 commit 4c1a375

File tree

2 files changed

+39
-40
lines changed

2 files changed

+39
-40
lines changed

src/Razor/Razor.Design/test/IntegrationTests/IntegrationTests/RazorCompileIntegrationTest.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.IO;
56
using System.Linq;
67
using System.Reflection;
@@ -41,15 +42,15 @@ public async Task RazorCompile_NoopsWithNoFiles()
4142

4243
Assert.BuildPassed(result);
4344

44-
// Everything we do should noop - including building the app.
45+
// Everything we do should noop - including building the app.
4546
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.dll");
4647
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.pdb");
4748
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.dll");
4849
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.Views.pdb");
4950
}
5051

5152
[Fact]
52-
[InitializeTestProject("SimpleMvc")]
53+
[InitializeTestProject("SimpleMvc")]
5354
public async Task RazorCompile_EmbedRazorGenerateSources_EmbedsCshtmlFiles()
5455
{
5556
var result = await DotnetMSBuild("RazorCompile", "/p:EmbedRazorGenerateSources=true");
@@ -63,16 +64,16 @@ public async Task RazorCompile_EmbedRazorGenerateSources_EmbedsCshtmlFiles()
6364

6465
Assert.Equal(new string[]
6566
{
66-
"/Views/_ViewImports.cshtml",
67-
"/Views/_ViewStart.cshtml",
6867
"/Views/Home/About.cshtml",
6968
"/Views/Home/Contact.cshtml",
7069
"/Views/Home/Index.cshtml",
70+
"/Views/Shared/Error.cshtml",
7171
"/Views/Shared/_Layout.cshtml",
7272
"/Views/Shared/_ValidationScriptsPartial.cshtml",
73-
"/Views/Shared/Error.cshtml",
73+
"/Views/_ViewImports.cshtml",
74+
"/Views/_ViewStart.cshtml",
7475
},
75-
resources.OrderBy(r => r));
76+
resources.OrderBy(r => r, StringComparer.Ordinal));
7677
}
7778

7879
[Fact]
@@ -90,16 +91,16 @@ public async Task RazorCompile_MvcRazorEmbedViewSources_EmbedsCshtmlFiles()
9091

9192
Assert.Equal(new string[]
9293
{
93-
"/Views/_ViewImports.cshtml",
94-
"/Views/_ViewStart.cshtml",
9594
"/Views/Home/About.cshtml",
9695
"/Views/Home/Contact.cshtml",
9796
"/Views/Home/Index.cshtml",
97+
"/Views/Shared/Error.cshtml",
9898
"/Views/Shared/_Layout.cshtml",
9999
"/Views/Shared/_ValidationScriptsPartial.cshtml",
100-
"/Views/Shared/Error.cshtml",
100+
"/Views/_ViewImports.cshtml",
101+
"/Views/_ViewStart.cshtml",
101102
},
102-
resources.OrderBy(r => r));
103+
resources.OrderBy(r => r, StringComparer.Ordinal));
103104
}
104105

105106
private Assembly LoadAssemblyFromBytes(params string[] paths)

src/Razor/Razor.Language/test/DefaultRazorProjectFileSystemTest.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.IO;
56
using System.Linq;
67
using Microsoft.AspNetCore.Testing;
@@ -77,15 +78,7 @@ public void EnumerateItems_DiscoversAllCshtmlFiles()
7778

7879
// Assert
7980
Assert.Collection(
80-
items.OrderBy(f => f.FilePath),
81-
item =>
82-
{
83-
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
84-
Assert.Equal("/", item.BasePath);
85-
Assert.Equal(Path.Combine(TestFolder, "_ViewImports.cshtml"), item.PhysicalPath);
86-
Assert.Equal("_ViewImports.cshtml", item.RelativePhysicalPath);
87-
88-
},
81+
items.OrderBy(f => f.FilePath, StringComparer.Ordinal),
8982
item =>
9083
{
9184
Assert.Equal("/Home.cshtml", item.FilePath);
@@ -96,33 +89,38 @@ public void EnumerateItems_DiscoversAllCshtmlFiles()
9689
},
9790
item =>
9891
{
99-
Assert.Equal("/Views/_ViewImports.cshtml", item.FilePath);
92+
Assert.Equal("/Views/About/About.cshtml", item.FilePath);
10093
Assert.Equal("/", item.BasePath);
101-
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
102-
Assert.Equal(Path.Combine("Views", "_ViewImports.cshtml"), item.RelativePhysicalPath);
103-
94+
Assert.Equal(Path.Combine(TestFolder, "Views", "About", "About.cshtml"), item.PhysicalPath);
95+
Assert.Equal(Path.Combine("Views", "About", "About.cshtml"), item.RelativePhysicalPath);
10496
},
10597
item =>
10698
{
107-
Assert.Equal("/Views/About/About.cshtml", item.FilePath);
99+
Assert.Equal("/Views/Home/Index.cshtml", item.FilePath);
108100
Assert.Equal("/", item.BasePath);
109-
Assert.Equal(Path.Combine(TestFolder, "Views", "About", "About.cshtml"), item.PhysicalPath);
110-
Assert.Equal(Path.Combine("Views", "About", "About.cshtml"), item.RelativePhysicalPath);
101+
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
102+
Assert.Equal(Path.Combine("Views", "Home", "Index.cshtml"), item.RelativePhysicalPath);
111103
},
112104
item =>
113105
{
114106
Assert.Equal("/Views/Home/_ViewImports.cshtml", item.FilePath);
115107
Assert.Equal("/", item.BasePath);
116108
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "_ViewImports.cshtml"), item.PhysicalPath);
117109
Assert.Equal(Path.Combine("Views", "Home", "_ViewImports.cshtml"), item.RelativePhysicalPath);
118-
119110
},
120111
item =>
121112
{
122-
Assert.Equal("/Views/Home/Index.cshtml", item.FilePath);
113+
Assert.Equal("/Views/_ViewImports.cshtml", item.FilePath);
123114
Assert.Equal("/", item.BasePath);
124-
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
125-
Assert.Equal(Path.Combine("Views", "Home", "Index.cshtml"), item.RelativePhysicalPath);
115+
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
116+
Assert.Equal(Path.Combine("Views", "_ViewImports.cshtml"), item.RelativePhysicalPath);
117+
},
118+
item =>
119+
{
120+
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
121+
Assert.Equal("/", item.BasePath);
122+
Assert.Equal(Path.Combine(TestFolder, "_ViewImports.cshtml"), item.PhysicalPath);
123+
Assert.Equal("_ViewImports.cshtml", item.RelativePhysicalPath);
126124
});
127125
}
128126

@@ -137,20 +135,20 @@ public void EnumerateItems_DiscoversAllCshtmlFiles_UnderSpecifiedBasePath()
137135

138136
// Assert
139137
Assert.Collection(
140-
items.OrderBy(f => f.FilePath),
138+
items.OrderBy(f => f.FilePath, StringComparer.Ordinal),
141139
item =>
142140
{
143-
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
141+
Assert.Equal("/About/About.cshtml", item.FilePath);
144142
Assert.Equal("/Views", item.BasePath);
145-
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
146-
Assert.Equal(Path.Combine("_ViewImports.cshtml"), item.RelativePhysicalPath);
143+
Assert.Equal(Path.Combine(TestFolder, "Views", "About", "About.cshtml"), item.PhysicalPath);
144+
Assert.Equal(Path.Combine("About", "About.cshtml"), item.RelativePhysicalPath);
147145
},
148146
item =>
149147
{
150-
Assert.Equal("/About/About.cshtml", item.FilePath);
148+
Assert.Equal("/Home/Index.cshtml", item.FilePath);
151149
Assert.Equal("/Views", item.BasePath);
152-
Assert.Equal(Path.Combine(TestFolder, "Views", "About", "About.cshtml"), item.PhysicalPath);
153-
Assert.Equal(Path.Combine("About", "About.cshtml"), item.RelativePhysicalPath);
150+
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
151+
Assert.Equal(Path.Combine("Home", "Index.cshtml"), item.RelativePhysicalPath);
154152
},
155153
item =>
156154
{
@@ -161,10 +159,10 @@ public void EnumerateItems_DiscoversAllCshtmlFiles_UnderSpecifiedBasePath()
161159
},
162160
item =>
163161
{
164-
Assert.Equal("/Home/Index.cshtml", item.FilePath);
162+
Assert.Equal("/_ViewImports.cshtml", item.FilePath);
165163
Assert.Equal("/Views", item.BasePath);
166-
Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
167-
Assert.Equal(Path.Combine("Home", "Index.cshtml"), item.RelativePhysicalPath);
164+
Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
165+
Assert.Equal(Path.Combine("_ViewImports.cshtml"), item.RelativePhysicalPath);
168166
});
169167
}
170168

0 commit comments

Comments
 (0)