Continuation of unit testing the Metric Dashboard.
Watching for new files
The Dashboard listens to the test result folder for new files. As this is done in another thread, the test must wait for the file to be read and processed in order to verify that the feature works. In the older versions of Typemock there was a VerifyWithTimeout api. Here is a hack to do the same with the lambda API’s. This test is actually an interesting test
- I delete the file before copying just to be sure.
- Here I am faking the current date to be the same as the date of the test – this is so that I get the correct value from CurrentProtection
- Hack to Wait for Load() to be called. In this hack I set an event once the method has been called and then I call the real Load() method.
- Copy file to watched location
- Wait for Load to be called
- Here a short wait is needed for the method to complete.