While working on FlexWiki security enhancements I needed the ability for my NUnit tests to execute some code that pulled configuration information out of the web.config file.  Since the NUnit tests ran in another directory while executing the tests inside of the VS.NET IDE I needed to have the configuration file to exist in the directory where my test DLL resided.  Here is what I put in my SetUp code of my test harness to copy the config file.

[SetUp]

public void Setup()

{

// Copy the web.config over to the nunit directory so config seetings can be loaded

File.Copy("..\\..\\..\\FlexWiki.Web\\web.config","FlexWiki.UnitTests.dll.config",

true);

Amazingly enough this was enough to get my tests running.  However if I run the tests using the nunit-gui the configuration settions are not found.  I suspect it has something to do with where the Nunit-gui.EXE is located.  I am not sure how I am going to figure out where to copy the configuration file in this case.

Comments


Comments are closed