Skip to content

Commit fdcc256

Browse files
committed
1 parent c427729 commit fdcc256

File tree

1 file changed

+46
-24
lines changed

1 file changed

+46
-24
lines changed

README.md

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,55 @@ public class SomeClassUsingFileSystemWatcher
156156
provides convenience functionality on top of the core abstractions.
157157

158158
- [`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.
159+
provides Roslyn analyzers to help use abstractions over static methods.
163160

164161
## Relationship with Testably.Abstractions
165162

166-
[`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.
167-
168-
### Key Differences and Features
169-
170-
**Testably.Abstractions** offers more extensive testing helpers and features compared to this project:
171-
172-
- **Advanced time handling** with `ITimeSystem` interface
173-
- **Random system abstractions** with `IRandomSystem` interface
174-
- **Drive management** with support for multiple drives and limited size simulation
175-
- **FileSystemWatcher** support for testing file system events
176-
- **SafeFileHandle** support for advanced file operations
177-
- **More comprehensive API** for complex testing scenarios
178-
179-
### Migration Guide
180-
181-
To switch from `TestableIO.System.IO.Abstractions.TestingHelpers` to `Testably.Abstractions.Testing`:
182-
183-
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)
184-
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
185-
3. **In your tests**: Use the `MockFileSystem` from `Testably.Abstractions.Testing` instead
163+
[`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.
164+
165+
### When to use Testably.Abstractions vs TestableIO
166+
- **Use TestableIO.System.IO.Abstractions** if you need:
167+
- Basic file system mocking capabilities
168+
- Direct manipulation of stored file entities (MockFileData, MockDirectoryData)
169+
- Established codebase with existing TestableIO integration
170+
171+
- **Use Testably.Abstractions** if you need:
172+
- Advanced testing scenarios (FileSystemWatcher, SafeFileHandles, multiple drives)
173+
- Additional abstractions (ITimeSystem, IRandomSystem)
174+
- Cross-platform file system simulation (Linux, MacOS, Windows)Expand commentComment on line R163ResolvedCode has comments. Press enter to view.
175+
- More extensive and consistent behavior validation
176+
- Active development and new features
177+
178+
### Migrating from TestableIO
179+
Switching from TestableIO to Testably only requires changes in your test projects:
180+
181+
1. Replace the NuGet package reference in your test projects:
182+
```xml
183+
<!-- Remove -->
184+
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" />
185+
<!-- Add -->
186+
<PackageReference Include="Testably.Abstractions.Testing" />
187+
```
188+
189+
2. Update your test code to use the new `MockFileSystem`:
190+
```csharp
191+
// Before (TestableIO)
192+
var fileSystem = new MockFileSystem();
193+
fileSystem.AddDirectory("some-directory");
194+
fileSystem.AddFile("some-file.txt", new MockFileData("content"));
195+
196+
// After (Testably)
197+
var fileSystem = new MockFileSystem();
198+
fileSystem.Directory.CreateDirectory("some-directory");
199+
fileSystem.File.WriteAllText("some-file.txt", "content");
200+
// or using fluent initialization:
201+
fileSystem.Initialize()
202+
.WithSubdirectory("some-directory")
203+
.WithFile("some-file.txt").Which(f => f
204+
.HasStringContent("content"));
205+
```
206+
207+
Your production code using `IFileSystem` remains unchanged.
186208

187209
### Architectural Differences
188210

0 commit comments

Comments
 (0)