{"repo":"TestableIO/System.IO.Abstractions","free":true,"listed":false,"github":"https://github.com/TestableIO/System.IO.Abstractions","clone":"git clone https://github.com/TestableIO/System.IO.Abstractions.git","description":"Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access!","language":"C#","stars":1628,"topics":["testing","mocks","dotnet","c-sharp","filesystem","io","cross-platform","tdd"],"license":"MIT","category":"dev-tools","readme_excerpt":"At the core of the library is IFileSystem and FileSystem . Instead of calling methods like File.ReadAllText directly, use IFileSystem.File.ReadAllText . We have exactly the same API, except that ours is injectable and testable. Usage Note: This NuGet package is also published as System.IO.Abstractions but we suggest to use the prefix to make clear that this is not an official .NET package. Test helpers The library also ships with a series of test helpers to save you from having to mock out every call, for basic scenarios. They are not a complete copy of a real-life file system, but they'll get you most of the way there. Note: This NuGet package is also published as System.IO.Abstractions.TestingHelpers but we suggest to use the prefix to make clear that this is not an official .NET package. We even support casting from the .NET Framework's untestable types to our testable wrappers: Mock support Since version 4.0 the top-level APIs expose interfaces instead of abstract base classes (these still exist, though), allowing you to completely mock the file system. Here's a small example, using Mockolate: Relationship with Testably.Abstractions 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. Test","default_branch":null,"files":null,"tree":[],"storefront":"/r/TestableIO","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/TestableIO/System.IO.Abstractions/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}