-
Notifications
You must be signed in to change notification settings - Fork 266
refactor: extract ACL related functionality #913
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
Merged
mergify
merged 32 commits into
TestableIO:main
from
vbreuss:topic/extract-acl-related-functionality
Dec 8, 2022
Merged
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4e51bc6
Fix incorrect value for `rollForward` in global.json
vbreuss 9907d0b
Restrict to "LatestMinor"
vbreuss 9355797
Only update version
vbreuss fae87ee
Re-Implement FileSystemExtensibility
vbreuss bc83607
Remove ACL-Features from Interfaces
vbreuss 27f4e62
Replace implementation with ACL extension methods
vbreuss d160c5d
Adjust implementation in TestingHelpers
vbreuss 33089c8
Adjust Parity-Tests
vbreuss 7fd4e89
Enable Serialization
vbreuss 67058b5
Throw correct exception when file or directory was not found
vbreuss ccc766a
Adjust tests
vbreuss af1ecbd
Revert not-working changes to global.json
vbreuss 94a82c2
Cleanup
vbreuss 43042ef
Fix lazy initialization of AccessControl
vbreuss f02b929
Update src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs
vbreuss e96ea48
Update src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs
vbreuss 5c580b1
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss a5194e1
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss e4ce495
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss bd5f6bf
Fix Codacy-Issues
vbreuss e967bc4
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss 76e320b
Rename "Clone" to "CloneFrom"
vbreuss fe9efba
Implement review findings:
vbtig 83b5817
Cleanup changed code
vbtig 84290ce
Implement review findings from @siprbaum
vbtig 3e5ca88
Merge remote-tracking branch 'origin/main' into topic/extract-acl-rel…
vbtig cb8cf44
Fix merge error
vbtig a522144
Implement review comments
vbtig b8e701c
Bump major version to 19.0
vbtig 66d5386
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss 73243c9
Merge branch 'main' into topic/extract-acl-related-functionality
vbreuss cbaf4cc
refactor: delete extra file
fgreinacher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
src/System.IO.Abstractions.TestingHelpers/FileSystemExtensibility.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace System.IO.Abstractions.TestingHelpers | ||
| { | ||
| internal class FileSystemExtensibility : IFileSystemExtensibility | ||
| { | ||
| private readonly Dictionary<string, object> _metadata = new(); | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.TryGetWrappedInstance{T}(out T)" /> | ||
| public bool TryGetWrappedInstance<T>(out T wrappedInstance) | ||
| { | ||
| wrappedInstance = default; | ||
| return false; | ||
| } | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.StoreMetadata{T}(string, T)" /> | ||
| public void StoreMetadata<T>(string key, T value) | ||
| { | ||
| _metadata[key] = value; | ||
| } | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.RetrieveMetadata{T}(string)" /> | ||
| public T RetrieveMetadata<T>(string key) | ||
| { | ||
| if (_metadata.TryGetValue(key, out object value) && | ||
| value is T castedValue) | ||
| { | ||
| return castedValue; | ||
| } | ||
|
|
||
| return default; | ||
| } | ||
|
|
||
| internal void Clone(FileSystemExtensibility template) | ||
vbreuss marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| foreach (var item in template._metadata) | ||
| { | ||
| _metadata[item.Key] = item.Value; | ||
| } | ||
| } | ||
|
|
||
| public static IFileSystemExtensibility GetNullObject(Func<Exception> exceptionFactory) | ||
| => new NullFileSystemExtensibility(exceptionFactory); | ||
|
|
||
| private class NullFileSystemExtensibility : IFileSystemExtensibility | ||
| { | ||
| private readonly Func<Exception> _exceptionFactory; | ||
|
|
||
| public NullFileSystemExtensibility(Func<Exception> exceptionFactory) | ||
| { | ||
| _exceptionFactory = exceptionFactory; | ||
| } | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.TryGetWrappedInstance{T}(out T)" /> | ||
| public bool TryGetWrappedInstance<T>(out T wrappedInstance) | ||
| { | ||
| wrappedInstance = default; | ||
| return false; | ||
| } | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.StoreMetadata{T}(string, T)" /> | ||
| public void StoreMetadata<T>(string key, T value) | ||
| { | ||
| _ = key; | ||
| _ = value; | ||
| throw _exceptionFactory.Invoke(); | ||
| } | ||
|
|
||
| /// <inheritdoc cref="IFileSystemExtensibility.RetrieveMetadata{T}(string)" /> | ||
| public T RetrieveMetadata<T>(string key) | ||
| { | ||
| _ = key; | ||
| throw _exceptionFactory.Invoke(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.