Skip to content

MockFileSystem.Directory.CreateDirectory should NOT throw IOException if conflicting file exists #1386

@EnomisG

Description

@EnomisG

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: good-first-issueIssues that are good for first time contributorstype: bugIssues that describe misbehaving functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions