Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Oct 28, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

devlead and others added 2 commits October 28, 2025 07:51
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 #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
GH4636: Enhance FileSystem Abstractions & tests
@pull pull bot locked and limited conversation to collaborators Oct 28, 2025
@pull pull bot added the ⤵️ pull label Oct 28, 2025
@pull pull bot merged commit 2276633 into rprouse:develop Oct 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant