Skip to content

How to Simulate Directory.CreateDirectory(path, UnixFileMode)? #823

@rfvgyhn

Description

@rfvgyhn

I'm trying to test permissions on a directory on Linux. I would expect the following to throw an UnauthorizedAccessException for /parent/child but it successfully creates the directory. Is there something I need to change to test this properly?

var fileSystem = new MockFileSystem();
fileSystem.Directory.CreateDirectory("/parent", UnixFileMode.None);
fileSystem.Directory.CreateDirectory("/parent/child");

I also tried with an AccessControlStategy but ExceptionFactory.AclAccessToPathDenied throws an IOException instead of UnauthorizedAccessException. Is that expected behavior?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions