How do I unit-test saving file to the disk?
问题 I know that it's strongly recommended to run unit-tests in separation from file system , because if you do touch file system in your test, you also test file system itself. OK, that's reasonable. My question is, if I want to test file saving to the disk, what do I do? As with database, I separate an interface that is responsible for database access, and then create another implementation of this for my tests? Or may be there's some other way? 回答1: My approach towards this is heavily biased on