I’ve previously indicated that I find certain parts of the .NET BCL difficult to work with in a DI/TDD fashion. My solution to this is (like many before me) to write wrappers for some of the key pain points. I’ve decided to throw them up on Google Code using an Apache 2.0 licence. The project is called Abstract2ion (for which there is no official pronunciation). It contains the following:
- IConsoleWrapper a wrapper around System.Console
- IFileSystemWrapper and friends which provides a (fairly light) abstraction of some of the file system classes. Currently this supports relatively limited read only access.
- ITimeSource which provides the current local and UTC time as a substitute for calling DateTime.Now and DateTime.UtcNow directly.
You can find the source and binaries at the Abstract2ion Google Code site. It consists of a single assembly with no dependencies other than on the .NET Framework.