I have some integration tests that test the processing of USB data from a USB listener that is part of our application. I want to be able to run these test even when the device the code is listening too isn’t present. i.e have my test code write to a device so my production code reads it and processes it. The device being present won’t effect the processing of the production code. Does anyone know if this is possible?
Thanks
EDIT: The reason that I’m trying this method is that the similar code works very well for the RS-232 version, i.e the integration tests write to the port and the presence of a device plugged in doesn’t effect the outcome.
I think you should write an alternative implementation of the class that is currently writing to your USB drive. So, you’ll need an interface or something and two classes that implement it. If the device is connect…use implementation 1, otherwise, use implementation 2 (writing to disk or something like that).