No, you would use a layout when writing a class that uses IRepository . For IRepository implementations IRepository you need to test the appropriate data source. For databases, this is a bit of a pain - for the file system, a little less.
If possible, if you can express your implementation in terms of threads or readers, you will make your life easier: tests for those parts of the implementation can go against data sources in memory or threads from resources in a test assembly. Of course, you probably need some tests that fall into a real database or file system, but hopefully less.
Whether you will call such tests a “unit” or not is a question of how you define unit tests; I personally don’t care too much about names, but I don’t care that I have tests. For databases, in particular, this can be somewhat painful (especially if you want to be able to run tests in parallel), but they can also be incredibly valuable, in my experience.
Jon skeet
source share