@@ -21,27 +21,29 @@ public void FilePathMatchesReference()
2121 Assert . Equal ( expected , actual ) ;
2222 }
2323
24- [ Fact ]
25- public void CacheRootFromOptions ( )
26- {
27- var cacheOptions = new PhysicalFileSystemCacheOptions ( ) ;
28- cacheOptions . CacheFolder = "cacheFolder" ;
29- cacheOptions . CacheRoot = "C:\\ Temp" ;
30-
31- var cacheRoot = PhysicalFileSystemCache . GetCacheRoot ( cacheOptions , null ) ;
32-
33- Assert . Equal ( Path . Combine ( cacheOptions . CacheRoot , cacheOptions . CacheFolder ) , cacheRoot ) ;
34- }
35-
36- [ Fact ]
37- public void CacheRootFromEnvironment ( )
24+ [ Theory ]
25+ #if Linux
26+ [ InlineData ( "cacheFolder" , "/Users/username" , null , null , "/Users/username/cacheFolder" ) ]
27+ [ InlineData ( "cacheFolder" , null , "/Users/WebRoot" , null , "/Users/WebRoot/cacheFolder" ) ]
28+ [ InlineData ( "cacheFolder" , "../Temp" , null , "/Users/this/a/root" , "/Users/this/a/Temp/cacheFolder" ) ]
29+ #elif OSX
30+ [ InlineData ( "cacheFolder" , "/Users/username" , null , null , "/Users/username/cacheFolder" ) ]
31+ [ InlineData ( "cacheFolder" , null , "/Users/WebRoot" , null , "/Users/WebRoot/cacheFolder" ) ]
32+ [ InlineData ( "cacheFolder" , "../Temp" , null , "/Users/this/a/root" , "/Users/this/a/Temp/cacheFolder" ) ]
33+ #elif Windows
34+ [ InlineData ( "cacheFolder" , "C:/Temp" , null , null , "C:/Temp/cacheFolder" ) ]
35+ [ InlineData ( "cacheFolder" , null , "C:/WebRoot" , null , "C:/WebRoot/cacheFolder" ) ]
36+ [ InlineData ( "cacheFolder" , "../Temp" , null , "C:/this/a/root" , "C:/this/a/Temp/cacheFolder" ) ]
37+ #endif
38+ public void CacheRootFromOptions ( string cacheFolder , string cacheRoot , string webRootPath , string contentRootPath , string expected )
3839 {
3940 var cacheOptions = new PhysicalFileSystemCacheOptions ( ) ;
40- cacheOptions . CacheFolder = "cacheFolder" ;
41+ cacheOptions . CacheFolder = cacheFolder ;
42+ cacheOptions . CacheRoot = cacheRoot ;
4143
42- var cacheRoot = PhysicalFileSystemCache . GetCacheRoot ( cacheOptions , "C: \\ WebRoot" ) ;
44+ var cacheRootResult = PhysicalFileSystemCache . GetCacheRoot ( cacheOptions , webRootPath , contentRootPath ) ;
4345
44- Assert . Equal ( Path . Combine ( "C: \\ WebRoot" , cacheOptions . CacheFolder ) , cacheRoot ) ;
46+ Assert . Equal ( expected , cacheRootResult ) ;
4547 }
4648 }
4749}
0 commit comments