Skip to content

Conversation

@vbreuss
Copy link
Member

@vbreuss vbreuss commented May 5, 2024

Add support for the IgnoreInaccessible option of EnumerationOptions.

In order to simulate access errors in the MockFileSystem, specify the IAccessControlStrategy, e.g.:

string inaccessiblePath = @"C:\Windows\System32\config";
mockFileSystem.WithAccessControlStrategy(
    new DefaultAccessControlStrategy((p, _)
        => !p.Equals(inaccessiblePath)));

When trying to enumerate the inaccessible file or directory, the MockFileSystem will throw an UnauthorizedAccessException. If EnumerationOptions.IgnoreInaccessible is set to true, it will instead skip the inaccessible file or directory.

After #589 this implements the remaining properties of EnumerationOptions that are mentioned in TestableIO/System.IO.Abstractions#653

@vbreuss vbreuss added the enhancement New feature or request label May 5, 2024
@vbreuss vbreuss self-assigned this May 5, 2024
@vbreuss vbreuss enabled auto-merge (squash) May 5, 2024 06:46
@vbreuss vbreuss force-pushed the topic/implement-enumerationoptions-2 branch from f03b0b4 to 4483bdf Compare May 5, 2024 06:47
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@github-actions
Copy link

github-actions bot commented May 5, 2024

Stryker.NET mutation tested the changes in the pull request:
Mutation testing badge

@vbreuss vbreuss merged commit d6b88dc into main May 5, 2024
@vbreuss vbreuss deleted the topic/implement-enumerationoptions-2 branch May 5, 2024 07:10
@github-actions
Copy link

github-actions bot commented May 5, 2024

This is addressed in release v3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants