File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Source/Testably.Abstractions.Testing/Helpers
Tests/Testably.Abstractions.Tests/FileSystem Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,11 @@ public override string GetFullPath(string path)
3232 string candidate ;
3333 if ( ! string . IsNullOrEmpty ( pathRoot ) && ! string . IsNullOrEmpty ( directoryRoot ) )
3434 {
35- if ( char . ToUpperInvariant ( pathRoot [ 0 ] ) != char . ToUpperInvariant ( directoryRoot [ 0 ] ) )
35+ if ( pathRoot [ 0 ] == DirectorySeparatorChar )
36+ {
37+ candidate = directoryRoot ;
38+ }
39+ else if ( char . ToUpperInvariant ( pathRoot [ 0 ] ) != char . ToUpperInvariant ( directoryRoot [ 0 ] ) )
3640 {
3741 candidate = path ;
3842 }
Original file line number Diff line number Diff line change @@ -26,6 +26,14 @@ public void Exists_File_ShouldReturnFalse(string path)
2626 result . Should ( ) . BeFalse ( ) ;
2727 }
2828
29+ [ Fact ]
30+ public void Exists_ForwardSlash_ShouldReturnTrue ( )
31+ {
32+ bool result = FileSystem . Directory . Exists ( "/" ) ;
33+
34+ result . Should ( ) . BeTrue ( ) ;
35+ }
36+
2937 [ Theory ]
3038 [ InlineData ( @"\\s" ) ]
3139 [ InlineData ( "<" ) ]
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ public void Exists_File_ShouldReturnFalse(string path)
3636 sut . Exists . Should ( ) . BeFalse ( ) ;
3737 }
3838
39+ [ Fact ]
40+ public void Exists_ForwardSlash_ShouldReturnTrue ( )
41+ {
42+ IDirectoryInfo sut = FileSystem . DirectoryInfo . New ( "/" ) ;
43+
44+ sut . Exists . Should ( ) . BeTrue ( ) ;
45+ }
46+
3947 [ Theory ]
4048 [ AutoData ]
4149 public void Exists_NotExistedPreviously_ShouldOnlyUpdateOnInitialization ( string path )
You can’t perform that action at this time.
0 commit comments