I am creating some tests for the validation tool I have written to validate a file. When an error is found with the file that it is checking I call Environment.Exit()
. This works fine to quit the program when when running normally.
However when I am running my tests and it comes across the Environment.Exit()
the test terminates but I want to continue testing afterwards and check the files that my program has produced. When the test terminates it gives the message:
The agent process was stopped while the test was running.
Is there anyway I can stop the test from ending prematurely due to this? Is there another way I can terminate the program but continue the tests? Should I consider multithreading?
Or should I just reconsider my implementation?