Skip to content

Commit a91390a

Browse files
authored
docs: Add comprehensive documentation about relationship with Testably.Abstractions (#1326)
This PR adds a detailed section to the README explaining the relationship between `TestableIO.System.IO.Abstractions` and `Testably.Abstractions`, addressing community questions about the differences and migration path between these two testing libraries.
1 parent 2fdecff commit a91390a

File tree

1 file changed

+53
-6
lines changed

1 file changed

+53
-6
lines changed

README.md

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,60 @@ public class SomeClassUsingFileSystemWatcher
150150
}
151151
```
152152

153-
## Related projects
153+
## Relationship with Testably.Abstractions
154+
155+
[`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.
156+
157+
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.
158+
159+
### When to use Testably.Abstractions vs TestableIO
160+
- **Use TestableIO.System.IO.Abstractions** if you need:
161+
- Basic file system mocking capabilities
162+
- Direct manipulation of stored file entities (MockFileData, MockDirectoryData)
163+
- Established codebase with existing TestableIO integration
164+
165+
- **Use Testably.Abstractions** if you need:
166+
- Advanced testing scenarios (FileSystemWatcher, SafeFileHandles, multiple drives)
167+
- Additional abstractions (ITimeSystem, IRandomSystem)
168+
- Cross-platform file system simulation (Linux, MacOS, Windows)Expand commentComment on line R163ResolvedCode has comments. Press enter to view.
169+
- More extensive and consistent behavior validation
170+
- Active development and new features
171+
172+
### Migrating from TestableIO
173+
Switching from TestableIO to Testably only requires changes in your test projects:
174+
175+
1. Replace the NuGet package reference in your test projects:
176+
```xml
177+
<!-- Remove -->
178+
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" />
179+
<!-- Add -->
180+
<PackageReference Include="Testably.Abstractions.Testing" />
181+
```
182+
183+
2. Update your test code to use the new `MockFileSystem`:
184+
```csharp
185+
// Before (TestableIO)
186+
var fileSystem = new MockFileSystem();
187+
fileSystem.AddDirectory("some-directory");
188+
fileSystem.AddFile("some-file.txt", new MockFileData("content"));
189+
190+
// After (Testably)
191+
var fileSystem = new MockFileSystem();
192+
fileSystem.Directory.CreateDirectory("some-directory");
193+
fileSystem.File.WriteAllText("some-file.txt", "content");
194+
// or using fluent initialization:
195+
fileSystem.Initialize()
196+
.WithSubdirectory("some-directory")
197+
.WithFile("some-file.txt").Which(f => f
198+
.HasStringContent("content"));
199+
```
200+
201+
Your production code using `IFileSystem` remains unchanged.
202+
203+
## Other related projects
154204

155205
- [`System.IO.Abstractions.Extensions`](https://github.com/TestableIO/System.IO.Abstractions.Extensions)
156-
provides convenience functionality on top of the core abstractions.
206+
provides convenience functionality on top of the core abstractions.
157207

158208
- [`System.IO.Abstractions.Analyzers`](https://github.com/TestableIO/System.IO.Abstractions.Analyzers)
159-
provides Roslyn analyzers to help use abstractions over static methods.
160-
161-
- [`Testably.Abstractions`](https://github.com/Testably/Testably.Abstractions)
162-
provides alternative test helpers and additional abstractions.
209+
provides Roslyn analyzers to help use abstractions over static methods.

0 commit comments

Comments
 (0)