1
1
// Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
+ using System ;
4
5
using System . IO ;
5
6
using System . Linq ;
6
7
using Microsoft . AspNetCore . Testing ;
@@ -77,15 +78,7 @@ public void EnumerateItems_DiscoversAllCshtmlFiles()
77
78
78
79
// Assert
79
80
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 ) ,
89
82
item =>
90
83
{
91
84
Assert . Equal ( "/Home.cshtml" , item . FilePath ) ;
@@ -96,33 +89,38 @@ public void EnumerateItems_DiscoversAllCshtmlFiles()
96
89
} ,
97
90
item =>
98
91
{
99
- Assert . Equal ( "/Views/_ViewImports .cshtml" , item . FilePath ) ;
92
+ Assert . Equal ( "/Views/About/About .cshtml" , item . FilePath ) ;
100
93
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 ) ;
104
96
} ,
105
97
item =>
106
98
{
107
- Assert . Equal ( "/Views/About/About .cshtml" , item . FilePath ) ;
99
+ Assert . Equal ( "/Views/Home/Index .cshtml" , item . FilePath ) ;
108
100
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 ) ;
111
103
} ,
112
104
item =>
113
105
{
114
106
Assert . Equal ( "/Views/Home/_ViewImports.cshtml" , item . FilePath ) ;
115
107
Assert . Equal ( "/" , item . BasePath ) ;
116
108
Assert . Equal ( Path . Combine ( TestFolder , "Views" , "Home" , "_ViewImports.cshtml" ) , item . PhysicalPath ) ;
117
109
Assert . Equal ( Path . Combine ( "Views" , "Home" , "_ViewImports.cshtml" ) , item . RelativePhysicalPath ) ;
118
-
119
110
} ,
120
111
item =>
121
112
{
122
- Assert . Equal ( "/Views/Home/Index .cshtml" , item . FilePath ) ;
113
+ Assert . Equal ( "/Views/_ViewImports .cshtml" , item . FilePath ) ;
123
114
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 ) ;
126
124
} ) ;
127
125
}
128
126
@@ -137,20 +135,20 @@ public void EnumerateItems_DiscoversAllCshtmlFiles_UnderSpecifiedBasePath()
137
135
138
136
// Assert
139
137
Assert . Collection (
140
- items . OrderBy ( f => f . FilePath ) ,
138
+ items . OrderBy ( f => f . FilePath , StringComparer . Ordinal ) ,
141
139
item =>
142
140
{
143
- Assert . Equal ( "/_ViewImports .cshtml" , item . FilePath ) ;
141
+ Assert . Equal ( "/About/About .cshtml" , item . FilePath ) ;
144
142
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 ) ;
147
145
} ,
148
146
item =>
149
147
{
150
- Assert . Equal ( "/About/About .cshtml" , item . FilePath ) ;
148
+ Assert . Equal ( "/Home/Index .cshtml" , item . FilePath ) ;
151
149
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 ) ;
154
152
} ,
155
153
item =>
156
154
{
@@ -161,10 +159,10 @@ public void EnumerateItems_DiscoversAllCshtmlFiles_UnderSpecifiedBasePath()
161
159
} ,
162
160
item =>
163
161
{
164
- Assert . Equal ( "/Home/Index .cshtml" , item . FilePath ) ;
162
+ Assert . Equal ( "/_ViewImports .cshtml" , item . FilePath ) ;
165
163
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 ) ;
168
166
} ) ;
169
167
}
170
168
0 commit comments