Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support remaining properties of EnumerationOptions #590

Merged
merged 1 commit into from May 5, 2024

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
Copy link

sonarcloud 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

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
12 checks passed
@vbreuss vbreuss deleted the topic/implement-enumerationoptions-2 branch May 5, 2024 07:10
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.

None yet

1 participant