I write unit tests to my code, using Moq as a mocking framework.
My code includes calls to the file system, using direct calls to System.IO
classes. For instance, File.Exists(...)
etc.
I'd like to change that code to be more testable, so I should have an interface, say IFile
, with a relevant method, say Exists(string path)
.
I know I can write it from scratch, but I thought that maybe there's a complete, robust framework that has both interfaces and implementations for the file system. This (desired) framework may also be some kind of a "service", and therefore its API doesn't have to be an "interface equivalent" to the System.IO
namespace.
Note that I'd really like to have interfaces (and not static methods) so that my code is ready for dependency injection
What I got so far:
- A somehow similar, yet not the same question was asked in stackoverflow
- In codeplex.com there's a project named CodePlex Source Control Client (link) that has such classes in the source code (see
/Source/TfsLibrary/Utility/
in the source code for specific details)
Any other recommendations?