I’ve got application A which runs application B as a console app. I’d like to write unit tests as part of application A which validate the input to/output from application B, but application B uses hard coded paths to look for some of its inputs. I’d like to be able to run the application, but intercept the call to read from c:\wherever\whatever.txt and provide the contents of that file myself.
Any frameworks or pieces which can do this for me?
This requires patching the Win32 CreateFile API function. Which is merely technically possible with Detours from Microsoft Research. Which requires unmanaged C or C++.
Tackle this problem at the source, having hard-coded path names in source code is unreasonable.