Answer from Adam Houldsworth:
I've done this in the past by creating a facade interface over the directory and file actions, that underneath are either implemented by System.IO or by a test implementation that uses dictionaries to store files. The only other thing I can think of is some sort of hijacking of methods, perhaps using Microsoft Fakes.