Describe the bug
Both native Directory.Exists and the wrapper FileSystem.Directory.Exists methods successfully pick up the root directory using a /. However, MockFileSystem.Directory.Exists does not on Windows.
It's also worth noting that MockFileSystem.DirectoryInfo.Exists does work.
To Reproduce
[Test]
public async Task MockDirectory_Exists_ShouldReturnTrue_IfArgIsFrontSlashAndRootDirExists()
{
string testDir = XFS.Path(@"c:\foo\bar\");
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ testDir, new MockDirectoryData() }
});
await That(fileSystem.Directory.Exists("/")).IsEqualTo(true);
}
Expected behavior
Test shouldn't fail on Windows.
Additional context
OS: Windows 11
.NET Version: net9.0/net8.0/net6.0/net472
Package Version: 22.0.11