Search code examples
c#unit-testingvs-unit-testing-framework

VS2012 run new instance of program after test method is run


I have a static configuration class that gets loaded up with values when the program starts, and any further attemps to modify it throw exceptions.

Unfortunately, VS2012's unit testing suite retains the same instance of the program running throughout tests, and on different tests I want to test different configurations. Is there a way to force the runner to "reset" the program or run further tests in a new instance of it? I'd like to do this in a way that avoids adding workaround code to the configuration class just to fit this scenario.


Solution

  • No there is no such option at present.

    You should reinitialize this static configuration as a part of your TestInitialize/TestCleanup methods but yes that means adding in some code to help achieve this.