11
11
12
12
namespace SIL . XForge . Scripture ;
13
13
14
- /// <summary>
15
- /// Represents what environment the application is running in.
16
- /// </summary>
17
- public enum RunMode
18
- {
19
- Development ,
20
- Production ,
21
- }
22
-
23
14
[ TestFixture ]
24
15
public class StartupTests
25
16
{
@@ -177,10 +168,15 @@ private static void IsSpaRoute_Helper(string path, RunMode[] runModes, bool expe
177
168
[ TestCase ( "/connect-project" ) ]
178
169
[ TestCase ( "/serval-administration" ) ]
179
170
[ TestCase ( "/system-administration" ) ]
171
+ // Handling '//login' may not be very important but would make sense to handle it as if it was normalized to
172
+ // '/login'.
173
+ [ TestCase ( "//login" ) ]
174
+ [ TestCase ( "//login//" ) ]
175
+ [ TestCase ( "///login" ) ]
180
176
public void IsSpaRoute_ProductionAndDevelopment_True ( string path )
181
177
{
182
178
RunMode [ ] runModes = [ RunMode . Production , RunMode . Development ] ;
183
- bool expected = true ;
179
+ const bool expected = true ;
184
180
IsSpaRoute_Helper ( path , runModes , expected ) ;
185
181
}
186
182
@@ -195,7 +191,7 @@ public void IsSpaRoute_ProductionAndDevelopment_True(string path)
195
191
public void IsSpaRoute_Development_True ( string path )
196
192
{
197
193
RunMode [ ] runModes = [ RunMode . Development ] ;
198
- bool expected = true ;
194
+ const bool expected = true ;
199
195
IsSpaRoute_Helper ( path , runModes , expected ) ;
200
196
}
201
197
@@ -221,7 +217,9 @@ public void IsSpaRoute_Development_True(string path)
221
217
[ TestCase ( "/??/login" ) ]
222
218
[ TestCase ( "/#login" ) ]
223
219
[ TestCase ( "/#/login" ) ]
224
- // It may or may not be possible for the path to be the empty string. If it is, let's have ASP.NET handle it.
220
+ // It may or may not be possible in practice for the path to be null or empty. If it is, let's have ASP.NET handle
221
+ // it.
222
+ [ TestCase ( null ) ]
225
223
[ TestCase ( "" ) ]
226
224
// The paths "/", "/Index", and "/Status/Error" are handled by ASP.NET and don't even get to IsSpaRoute. If they did
227
225
// for some reason, we'll have IsSpaRoute return false.
@@ -235,7 +233,7 @@ public void IsSpaRoute_Development_True(string path)
235
233
public void IsSpaRoute_ProductionAndDevelopment_False ( string path )
236
234
{
237
235
RunMode [ ] runModes = [ RunMode . Production , RunMode . Development ] ;
238
- bool expected = false ;
236
+ const bool expected = false ;
239
237
IsSpaRoute_Helper ( path , runModes , expected ) ;
240
238
}
241
239
@@ -244,10 +242,19 @@ public void IsSpaRoute_ProductionAndDevelopment_False(string path)
244
242
public void IsSpaRoute_Development_False ( string path )
245
243
{
246
244
RunMode [ ] runModes = [ RunMode . Development ] ;
247
- bool expected = false ;
245
+ const bool expected = false ;
248
246
IsSpaRoute_Helper ( path , runModes , expected ) ;
249
247
}
250
248
249
+ /// <summary>
250
+ /// Represents what environment the application is running in.
251
+ /// </summary>
252
+ private enum RunMode
253
+ {
254
+ Development ,
255
+ Production ,
256
+ }
257
+
251
258
private class TestEnvironment
252
259
{
253
260
public TestEnvironment ( string ? environmentName = null )
0 commit comments