diff --git a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs index 141c01a2c..5b9e7968b 100644 --- a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs +++ b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs @@ -174,7 +174,7 @@ public override void Delete(string path, bool recursive) /// public override bool Exists(string path) { - if (path == "/" && XFS.IsUnixPlatform()) + if (path == "/") { return true; } diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs index fcad7ebe5..3a0711ff3 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs @@ -2181,7 +2181,7 @@ public async Task Move_Directory_DoesNotThrow_When_Target_Directory_Parent_Exist string sourceDirName, string targetDirName) { - // Arange + // Arrange var fileSystem = new MockFileSystem(); fileSystem.Directory.CreateDirectory(sourceDirName); @@ -2192,4 +2192,16 @@ public async Task Move_Directory_DoesNotThrow_When_Target_Directory_Parent_Exist await That(fileSystem.Directory.Exists(targetDirName)).IsTrue(); await That(fileSystem.Directory.Exists(sourceDirName)).IsFalse(); } + + [Test] + public async Task MockDirectory_Exists_ShouldReturnTrue_IfArgIsFrontSlashAndRootDirExists() + { + string testDir = XFS.Path(@"c:\foo\bar\"); + var fileSystem = new MockFileSystem(new Dictionary + { + { testDir, new MockDirectoryData() } + }); + + await That(fileSystem.Directory.Exists("/")).IsEqualTo(true); + } } \ No newline at end of file