-
-
Notifications
You must be signed in to change notification settings - Fork 763
GH4636: Enhance FileSystem Abstractions & tests #4637
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
Merged
Conversation
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
ffd8a82 to
184fc57
Compare
184fc57 to
cbe8e87
Compare
Added timestamps, Unix modes, performance improvements and dedicated for Fake File/Directory. - Add comprehensive timestamp and Unix file mode support across IFile/IDirectory interfaces - Implement LastWriteTimeUtc, CreationTimeUtc, LastAccessTimeUtc, and UnixFileMode properties - Add Set* methods for timestamp and Unix file mode manipulation - Improve performance by replacing GetFiles/GetDirectories with EnumerateFiles/EnumerateDirectories - Create dedicated Cake.Testing.Tests project with comprehensive unit test coverage - Add snapshot testing with Verify for FakeFile and FakeDirectory operations - Fill gaps in file system abstraction with cross-platform Unix file mode support - Integrate Microsoft.Extensions.TimeProvider.Testing for reliable time handling in tests - Refactor FakeDirectory to use yield return for lazy evaluation performance benefits - Add extensive test coverage for Create, Move, Delete, GetDirectories, and GetFiles operations - fixes cake-build#4636 ### Breaking Changes - [x] There shouldn't be any breaking changes identified, all new interface members have default implementations / values. #### IFileSystemInfo Interface (Base interface) - [x] `DateTime? LastWriteTimeUtc` - Default: `null` - [x] `DateTime? CreationTimeUtc` - Default: `null` - [x] `DateTime? LastAccessTimeUtc` - Default: `null` - [x] `UnixFileMode? UnixFileMode` - Default: `null` #### IDirectory Interface - [x] `IDirectory SetCreationTime(DateTime creationTime)` - Default: `return this` - [x] `IDirectory SetCreationTimeUtc(DateTime creationTimeUtc)` - Default: `return this` - [x] `IDirectory SetLastAccessTime(DateTime lastAccessTime)` - Default: `return this` - [x] `IDirectory SetLastAccessTimeUtc(DateTime lastAccessTimeUtc)` - Default: `return this` - [x] `IDirectory SetLastWriteTime(DateTime lastWriteTime)` - Default: `return this` - [x] `IDirectory SetLastWriteTimeUtc(DateTime lastWriteTimeUtc)` - Default: `return this` - [x] `IDirectory SetUnixFileMode(UnixFileMode unixFileMode)` - Default: `return this` #### IFile Interface - [x] `IFile SetUnixFileMode(UnixFileMode unixFileMode)` - Default: `return this` ### Key Changes Made - [x] Added UTC time properties to IFileSystemInfo with default null values - [x] Added Unix file mode support with UnixFileMode property and setter methods - [x] Added time setter methods for both IDirectory and IFile interfaces - [x] Performance improvement: Changed from GetDirectories()/GetFiles() to EnumerateDirectories()/EnumerateFiles() - [x] Added _file.Refresh() calls after time-setting operations to ensure consistency - [x] Added platform-specific attributes ([UnsupportedOSPlatform("windows")]) for Unix-specific methods
cbe8e87 to
f160300
Compare
gep13
approved these changes
Oct 28, 2025
Member
gep13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Member
|
@devlead thank you for getting this done! |
This was referenced Nov 11, 2025
This was referenced Nov 11, 2025
This was referenced Nov 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added timestamps, Unix modes, performance improvements and dedicated for Fake File/Directory.
Breaking Changes
IFileSystemInfo Interface (Base interface)
DateTime? LastWriteTimeUtc- Default:nullDateTime? CreationTimeUtc- Default:nullDateTime? LastAccessTimeUtc- Default:nullUnixFileMode? UnixFileMode- Default:nullIDirectory Interface
IDirectory SetCreationTime(DateTime creationTime)- Default:return thisIDirectory SetCreationTimeUtc(DateTime creationTimeUtc)- Default:return thisIDirectory SetLastAccessTime(DateTime lastAccessTime)- Default:return thisIDirectory SetLastAccessTimeUtc(DateTime lastAccessTimeUtc)- Default:return thisIDirectory SetLastWriteTime(DateTime lastWriteTime)- Default:return thisIDirectory SetLastWriteTimeUtc(DateTime lastWriteTimeUtc)- Default:return thisIDirectory SetUnixFileMode(UnixFileMode unixFileMode)- Default:return thisIFile Interface
IFile SetUnixFileMode(UnixFileMode unixFileMode)- Default:return thisKey Changes Made