@@ -10,6 +10,50 @@ namespace System.IO.Abstractions.TestingHelpers.Tests
1010 [ TestFixture ]
1111 public class MockDirectoryTests
1212 {
13+ [ Test ]
14+ public void MockDirectory_GetFiles_ShouldReturnAllFilesBelowPathWhenPatternIsEmptyAndSearchOptionIsAllDirectories ( )
15+ {
16+ // Arrange
17+ var fileSystem = SetupFileSystem ( ) ;
18+ var expected = new [ ]
19+ {
20+ XFS . Path ( @"c:\a\a.txt" ) ,
21+ XFS . Path ( @"c:\a\b.gif" ) ,
22+ XFS . Path ( @"c:\a\c.txt" ) ,
23+ XFS . Path ( @"c:\a\d" ) ,
24+ XFS . Path ( @"c:\a\a\a.txt" ) ,
25+ XFS . Path ( @"c:\a\a\b.txt" ) ,
26+ XFS . Path ( @"c:\a\a\c.gif" ) ,
27+ XFS . Path ( @"c:\a\a\d" )
28+ } ;
29+
30+ // Act
31+ var result = fileSystem . Directory . GetFiles ( XFS . Path ( @"c:\a" ) , "" , SearchOption . AllDirectories ) ;
32+
33+ // Assert
34+ Assert . That ( result , Is . EquivalentTo ( expected ) ) ;
35+ }
36+
37+ [ Test ]
38+ public void MockDirectory_GetFiles_ShouldReturnFilesDirectlyBelowPathWhenPatternIsEmptyAndSearchOptionIsTopDirectoryOnly ( )
39+ {
40+ // Arrange
41+ var fileSystem = SetupFileSystem ( ) ;
42+ var expected = new [ ]
43+ {
44+ XFS . Path ( @"c:\a\a.txt" ) ,
45+ XFS . Path ( @"c:\a\b.gif" ) ,
46+ XFS . Path ( @"c:\a\c.txt" ) ,
47+ XFS . Path ( @"c:\a\d" )
48+ } ;
49+
50+ // Act
51+ var result = fileSystem . Directory . GetFiles ( XFS . Path ( @"c:\a" ) , "" , SearchOption . TopDirectoryOnly ) ;
52+
53+ // Assert
54+ Assert . That ( result , Is . EquivalentTo ( expected ) ) ;
55+ }
56+
1357 [ Test ]
1458 public void MockDirectory_GetFiles_ShouldReturnAllFilesBelowPathWhenPatternIsWildcardAndSearchOptionIsAllDirectories ( )
1559 {
0 commit comments