-
Notifications
You must be signed in to change notification settings - Fork 266
Description
Similar to Testably/Testably.Abstractions#471 it would be also good to add a section to this README what the relationship with Testably.Abstractions is.
Both projects use the same interfaces from TestableIO.System.IO.Abstractions so that no changes on the production code is necessary, when switching the testing library. The testing helpers in the Testably project are much more extensive (e.g. time handling, support for drives, the file system watcher or working with SafeFileHandles is possible there, but not here) and also include further interfaces (ITimeSystem and IRandomSystem).
I am currently the main contributor in both projects, but my focus is definitely on the Testably-projects.
If you want to switch, you have to reference Testably.Abstractions.Testing in your test project and use the MockFileSystem from there. You don't have to change anything in your productive code!
Originally I tried to implement the features in TestableIO, but had some blocking issues. Due to the architecture of allowing direct access to the stored entities (MockFileData and MockDirectoryData) it is very hard to keep a consistent state. When I wanted to implement correct update of LastAccessTime and LastUpdateTime it got very complicated. That was the reason, I started with Testably. Here the MockFileSystem is much more restrictive in how you can manipulate it (more or less the normal file system operations), but this allows some advanced scenarios like FileSystemWatcher, correct time updates, working with multiple drives with limited size, Testably/Testably.Abstractions#460, etc.
Also the test suite is much more extensive and runs on the build system against the real file system on Linux, Windows and MacOS which means, that the tested scenarios work the same on the mock and the real file system.
The two projects use the same interfaces and for the forseeable future, I will maintain both, but will not invest much time in new functionality in TestableIO.
When you compare these project you have to distinguish the API surface in your production projects and in your test projects. By using the same interface dependency, you can switch between Testably.Abstractions.Testing and TestableIO.System.IO.Abstractions.TestingHelpers without adapting your production code. That is also the reason, why I did not change the used namespace (System.IO.Abstractions was used a long time ago).
But the two testing projects have a very different API surface and are not interchangeable.