From c34f933868f600767e2fd7d52abf9eb2922b71ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 Aug 2025 19:52:43 +0000 Subject: [PATCH 1/5] Initial plan From c427729e4c16922c997ed65f6edb16b118994238 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 Aug 2025 19:59:28 +0000 Subject: [PATCH 2/5] Add comprehensive section about relationship with Testably.Abstractions Co-authored-by: vbreuss <3438234+vbreuss@users.noreply.github.com> --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index acf5b3a5e..439503a54 100644 --- a/README.md +++ b/README.md @@ -160,3 +160,42 @@ public class SomeClassUsingFileSystemWatcher - [`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) provides alternative test helpers and additional abstractions. + +## Relationship with Testably.Abstractions + +[`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) is a complementary project that uses the same interfaces from [`TestableIO.System.IO.Abstractions`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions). This means **no changes to your production code are necessary** when switching between the testing libraries. + +### Key Differences and Features + +**Testably.Abstractions** offers more extensive testing helpers and features compared to this project: + +- **Advanced time handling** with `ITimeSystem` interface +- **Random system abstractions** with `IRandomSystem` interface +- **Drive management** with support for multiple drives and limited size simulation +- **FileSystemWatcher** support for testing file system events +- **SafeFileHandle** support for advanced file operations +- **More comprehensive API** for complex testing scenarios + +### Migration Guide + +To switch from `TestableIO.System.IO.Abstractions.TestingHelpers` to `Testably.Abstractions.Testing`: + +1. **In your test projects**: Replace the reference to [`TestableIO.System.IO.Abstractions.TestingHelpers`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions.TestingHelpers) with [`Testably.Abstractions.Testing`](https://www.nuget.org/packages/Testably.Abstractions.Testing) +2. **In your production code**: No changes needed! Both libraries use the same [`TestableIO.System.IO.Abstractions`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions) interfaces +3. **In your tests**: Use the `MockFileSystem` from `Testably.Abstractions.Testing` instead + +### Architectural Differences + +The main architectural difference lies in how the mock file systems handle state: + +- **TestableIO.System.IO.Abstractions** allows direct access to stored entities (`MockFileData` and `MockDirectoryData`), which can make maintaining consistent state challenging, especially for features like correct `LastAccessTime` and `LastWriteTime` updates. + +- **Testably.Abstractions** uses a more restrictive approach that only allows manipulation through normal file system operations, enabling advanced scenarios like consistent time updates, FileSystemWatcher support, and multi-drive simulation. + +### Testing and Compatibility + +`Testably.Abstractions` features a more extensive test suite that runs against real file systems on Linux, Windows, and macOS. This ensures that tested scenarios work identically on both the mock and real file systems. + +### Maintenance and Development + +Both projects share the same maintainer, but active development and new features are primarily focused on the Testably.Abstractions project. TestableIO.System.IO.Abstractions continues to be maintained for stability and compatibility, but significant new functionality is unlikely to be added. From fdcc256f8ba0236ad7bdb6e464684ba74bfa894b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Tue, 12 Aug 2025 22:08:32 +0200 Subject: [PATCH 3/5] Adapt to use similar text as in https://github.com/Testably/Testably.Abstractions/pull/835/files --- README.md | 70 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 439503a54..d42b66520 100644 --- a/README.md +++ b/README.md @@ -156,33 +156,55 @@ public class SomeClassUsingFileSystemWatcher provides convenience functionality on top of the core abstractions. - [`System.IO.Abstractions.Analyzers`](https://github.com/TestableIO/System.IO.Abstractions.Analyzers) - provides Roslyn analyzers to help use abstractions over static methods. - -- [`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) - provides alternative test helpers and additional abstractions. + provides Roslyn analyzers to help use abstractions over static methods. ## Relationship with Testably.Abstractions -[`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) is a complementary project that uses the same interfaces from [`TestableIO.System.IO.Abstractions`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions). This means **no changes to your production code are necessary** when switching between the testing libraries. - -### Key Differences and Features - -**Testably.Abstractions** offers more extensive testing helpers and features compared to this project: - -- **Advanced time handling** with `ITimeSystem` interface -- **Random system abstractions** with `IRandomSystem` interface -- **Drive management** with support for multiple drives and limited size simulation -- **FileSystemWatcher** support for testing file system events -- **SafeFileHandle** support for advanced file operations -- **More comprehensive API** for complex testing scenarios - -### Migration Guide - -To switch from `TestableIO.System.IO.Abstractions.TestingHelpers` to `Testably.Abstractions.Testing`: - -1. **In your test projects**: Replace the reference to [`TestableIO.System.IO.Abstractions.TestingHelpers`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions.TestingHelpers) with [`Testably.Abstractions.Testing`](https://www.nuget.org/packages/Testably.Abstractions.Testing) -2. **In your production code**: No changes needed! Both libraries use the same [`TestableIO.System.IO.Abstractions`](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions) interfaces -3. **In your tests**: Use the `MockFileSystem` from `Testably.Abstractions.Testing` instead +[`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) is a complementary project that uses the same interfaces as TestableIO. This means **no changes to your production code are necessary** when switching between the testing libraries. + +### When to use Testably.Abstractions vs TestableIO +- **Use TestableIO.System.IO.Abstractions** if you need: + - Basic file system mocking capabilities + - Direct manipulation of stored file entities (MockFileData, MockDirectoryData) + - Established codebase with existing TestableIO integration + +- **Use Testably.Abstractions** if you need: + - Advanced testing scenarios (FileSystemWatcher, SafeFileHandles, multiple drives) + - Additional abstractions (ITimeSystem, IRandomSystem) + - Cross-platform file system simulation (Linux, MacOS, Windows)Expand commentComment on line R163ResolvedCode has comments. Press enter to view. + - More extensive and consistent behavior validation + - Active development and new features + +### Migrating from TestableIO +Switching from TestableIO to Testably only requires changes in your test projects: + +1. Replace the NuGet package reference in your test projects: + ```xml + + + + + ``` + +2. Update your test code to use the new `MockFileSystem`: + ```csharp + // Before (TestableIO) + var fileSystem = new MockFileSystem(); + fileSystem.AddDirectory("some-directory"); + fileSystem.AddFile("some-file.txt", new MockFileData("content")); + + // After (Testably) + var fileSystem = new MockFileSystem(); + fileSystem.Directory.CreateDirectory("some-directory"); + fileSystem.File.WriteAllText("some-file.txt", "content"); + // or using fluent initialization: + fileSystem.Initialize() + .WithSubdirectory("some-directory") + .WithFile("some-file.txt").Which(f => f + .HasStringContent("content")); + ``` + +Your production code using `IFileSystem` remains unchanged. ### Architectural Differences From 3c2be9fd9623eb1bb0d1a0cdaecbd755e199249e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:13:27 +0000 Subject: [PATCH 4/5] docs: Add pull request title guidelines section to README Co-authored-by: vbreuss <3438234+vbreuss@users.noreply.github.com> --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d42b66520..b20f83157 100644 --- a/README.md +++ b/README.md @@ -221,3 +221,13 @@ The main architectural difference lies in how the mock file systems handle state ### Maintenance and Development Both projects share the same maintainer, but active development and new features are primarily focused on the Testably.Abstractions project. TestableIO.System.IO.Abstractions continues to be maintained for stability and compatibility, but significant new functionality is unlikely to be added. + +## Contributing + +### Pull Request Title +To communicate intent to the consumers of your library, the title of the pull requests is prefixed with one of the following elements: +- `fix:`: patches a bug +- `feat:`: introduces a new feature +- `refactor:`: improves internal structure without changing the observable behavior +- `docs:`: updates documentation or XML comments +- `chore:`: updates to dependencies, build pipelines, ... From 465939fa26aff31f733d0855c4cbf056d57bb315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Tue, 12 Aug 2025 22:16:00 +0200 Subject: [PATCH 5/5] Further refinement --- README.md | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d42b66520..1c46a4528 100644 --- a/README.md +++ b/README.md @@ -150,17 +150,10 @@ public class SomeClassUsingFileSystemWatcher } ``` -## Related projects - -- [`System.IO.Abstractions.Extensions`](https://github.com/TestableIO/System.IO.Abstractions.Extensions) - provides convenience functionality on top of the core abstractions. - -- [`System.IO.Abstractions.Analyzers`](https://github.com/TestableIO/System.IO.Abstractions.Analyzers) - provides Roslyn analyzers to help use abstractions over static methods. - ## Relationship with Testably.Abstractions [`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions) is a complementary project that uses the same interfaces as TestableIO. This means **no changes to your production code are necessary** when switching between the testing libraries. +Both projects share the same maintainer, but active development and new features are primarily focused on the Testably.Abstractions project. TestableIO.System.IO.Abstractions continues to be maintained for stability and compatibility, but significant new functionality is unlikely to be added. ### When to use Testably.Abstractions vs TestableIO - **Use TestableIO.System.IO.Abstractions** if you need: @@ -175,6 +168,7 @@ public class SomeClassUsingFileSystemWatcher - More extensive and consistent behavior validation - Active development and new features + ### Migrating from TestableIO Switching from TestableIO to Testably only requires changes in your test projects: @@ -206,18 +200,10 @@ Switching from TestableIO to Testably only requires changes in your test project Your production code using `IFileSystem` remains unchanged. -### Architectural Differences - -The main architectural difference lies in how the mock file systems handle state: +## Other related projects -- **TestableIO.System.IO.Abstractions** allows direct access to stored entities (`MockFileData` and `MockDirectoryData`), which can make maintaining consistent state challenging, especially for features like correct `LastAccessTime` and `LastWriteTime` updates. - -- **Testably.Abstractions** uses a more restrictive approach that only allows manipulation through normal file system operations, enabling advanced scenarios like consistent time updates, FileSystemWatcher support, and multi-drive simulation. - -### Testing and Compatibility - -`Testably.Abstractions` features a more extensive test suite that runs against real file systems on Linux, Windows, and macOS. This ensures that tested scenarios work identically on both the mock and real file systems. - -### Maintenance and Development +- [`System.IO.Abstractions.Extensions`](https://github.com/TestableIO/System.IO.Abstractions.Extensions) + provides convenience functionality on top of the core abstractions. -Both projects share the same maintainer, but active development and new features are primarily focused on the Testably.Abstractions project. TestableIO.System.IO.Abstractions continues to be maintained for stability and compatibility, but significant new functionality is unlikely to be added. +- [`System.IO.Abstractions.Analyzers`](https://github.com/TestableIO/System.IO.Abstractions.Analyzers) + provides Roslyn analyzers to help use abstractions over static methods. \ No newline at end of file