I'm curious what's so abysmal about the design of the System.IO
namespace. Granted, choosing a particular interface or class can be somewhat of an arbitrary exercise, but I'm not familiar with the problem of having to pass strings around all over the place.
Perhaps you could give some more information about your particular issue?
EDIT
You seem to indicate that you want classes that build upon the System.IO
namespace that will allow you to test without writing to the file system. I'm not seeing how you can adequately test a function that writes to the file system without it, well, writing to the file system. If you want to test your logic from a writing perspective, then allow you functions to take System.IO.Stream
or System.IO.TextWriter
, whichever is more appropriate. This will allow you to test the various components of your code without necessarily having any outside impact; just pass a System.IO.MemoryStream
instead of a System.IO.FileStream
. Obviously you won't run into issues like running out of space, access denied, etc., but you can't ever encounter those errors without running live against the file system. That's why you can expose outer functions that take System.IO.FileInfo
or a string path (or an array/IEnumerable<>
of either, whatever you need) that can provide another level of testing that's live.
The System.IO
namespace is pretty well populated, and I've never run into a particularly non-OO approach being used.