Describe the bug
Not all matches are returned from DirectoryInfo.EnumerateFileSystemInfo. It looks like that the RecurseSubdirectories is ignored.
To Reproduce
[Test]
public void Delete_Me()
{
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>()
{
{ @"c:\bla.txt", null },
{ @"c:\Test\test.txt", null },
{ @"c:\Test\more-test.png", null },
{ @"c:\Test\A\deep-nested.png", null },
});
var path = @"C:\";
var searchPattern = "*";
var enumerateFileSystemEntries = fileSystem.Directory
.EnumerateFileSystemEntries(path, searchPattern, SearchOption.AllDirectories)
.OrderBy(r => r);
var directoryInfo = fileSystem.DirectoryInfo.FromDirectoryName(path);
var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(searchPattern, new EnumerationOptions()
{
MatchType = MatchType.Win32,
RecurseSubdirectories = true,
IgnoreInaccessible = true,
ReturnSpecialDirectories = false,
AttributesToSkip = FileAttributes.Hidden,
MatchCasing = MatchCasing.PlatformDefault,
})
.Select(r => r.FullName);
CollectionAssert.AreEquivalent(enumerateFileSystemEntries, fileSystemInfos);
}
Expected: equivalent to < "c:\bla.txt", "C:\temp", "c:\Test", "c:\Test\A", "c:\Test\A\deep-nested.png", "c:\Test\more-test.png", "c:\Test\test.txt" >
But was: < "c:\Test", "C:\temp", "c:\bla.txt" >
Missing (4): < "c:\Test\A", "c:\Test\A\deep-nested.png", "c:\Test\more-test.png", "c:\Test\test.txt" >
Expected behavior
I would expect that EnumerateFileSystemEntries and EnumerateFileSystemInfos resulted in the same list. It is doing that for the .net core implementation.
Describe the bug
Not all matches are returned from DirectoryInfo.EnumerateFileSystemInfo. It looks like that the RecurseSubdirectories is ignored.
To Reproduce
Expected behavior
I would expect that EnumerateFileSystemEntries and EnumerateFileSystemInfos resulted in the same list. It is doing that for the .net core implementation.