Using VS2008, we would like to simulate a file that has a size of X, but that has a read failure at X-Y bytes, so that we get an error indication.
Anyone have an idea of how to do this on windows? Looks like there is a solution for linux, but I can’t really come up with a way to do this on windows. We have multiple developers, multiple machines, and cppunit testing framework, so I want a software only design.
I’m trying to simulate the actual CRT failing, so I can test the code that is dealing with the failure.
Wrap the file I/O functions in a class; override those in a testing derived class; simulate failure with a fake or mock.