MockFileSystem.Directory.CreateDirectory should NOT throw IOException if conflicting file exists
Describe the bug The MockFileSystem throws an IOException if a conflicting file exists. The real System.IO.Directory.CreateDirectory method returns an object that represents the directory at the specified path. This object is returned regardless of whether a directory at the specified path already exists.
To Reproduce Steps to reproduce the behavior:
var fileSystem = new MockFileSystem();
fileSystem.AddDirectory(@"c:\test");
fileSystem.Directory.CreateDirectory(@"c:\test");
Expected behavior An object that represents the directory at the specified path. This object is returned regardless of whether a directory at the specified path already exists.
Additional context CreateDirectory Definition MockFileSystem.Directory.CreateDirectory should throw IOException if conflicting file exists #968
Thanks for reporting. Do you want to create a pull request for this issue?
I can't seem to reproduce this, with v22.1.0 on Linux. The provided code snippet acts as expected, ie does not error, with the third line (fileSystem.Directory.CreateDirectory(@"c:\test");) returning info about the existing c:\test as expected. Maybe I am missing something, or its my platform/environment?