As many of you know, the System.IO namespace is abysmally designed. I would like a free library that wraps the file IO functionality in a sane way (read: doesn't require you passing strings all over the place). I remember reading some time ago that there is a small handful of these libraries already written (and the author was surprised that there were not more). I think it was one of the guys on devlicious or codebetter or Los Techies that did one of them.
Does anyone know what I'm talking about or another good File IO wrapper?
Edit: I suppose I should specify that I do Test Driven Development and my concerns are largely (but not entirely) around System.IO's test friendliness.
Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and ...
The simple concept of TDD is to write and correct the failed tests before writing new code (before development). This helps to avoid duplication of code as we write a small amount of code at a time in order to pass tests.
TDD stands for test-driven development. It's a common misconception to think TDD is a testing technique, and the name certainly plays a part in that. Actually, TDD is a software development methodology in which you use unit tests to drive the development of the code.
What's wrong with System.IO.FileInfo?
I was curious, so started to create a set of wrappers using ReSharper. It took me 16 minutes, and I haven't tested it, and don't know if it meets your needs. Still, I thought I'd outline the process I used:
The result is interfaces that include the methods and properties of the corresponding classes, and concrete classes that delegate to the original classes and implement the interfaces. You should then be able to create your own mock classes, and change your code to use the interfaces instead of directly using the System.IO concrete classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With