NUnit and the Configuration Management Application Block

  • Thread starter Thread starter Biff Gaut
  • Start date Start date
B

Biff Gaut

We are using the Configuration Management Application Block of the
MSDN site to handle configuration information for our system. We
would also like to use NUnit to run daily unit tests. Our problem is
that we can't get our assemblies to see the configuration information
they require when they run in the NUnit context. Has anyone had any
success using NUnit and the Configuration Managemement Application
Block?

Biff Gaut
Gaithersburg, MD
 
I've found the answer on my own, so am posting it for anyone who
stumbles on this thread in the future.

The configuration information should all be located in a config file
that is named after the assembly containing all the test classes, for
us this was UnitTest.dll.config, and located in the same directory as
the assembly containing the tests - note that this does not say the
dll or dll's being tested. Since the build process cleans up the
release or debug folders whenever you build, this file can be named
app.config and put in the project folder containing the TESTING code
(again, not the dll being tested) to take advantage of the VS.NET
feature to automatically copy and rename the configuration file with
each build.

Biff Gaut
Gaithersburg, MD
 
Hi Biff,

Thank you very much for sharing this information from which others will
also benefit.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The automatic copy feature for App.Config does not work in this
instance since we are compiling a DLL. In order to copy the
App.Config file to the appropriate name and folder you must add the
following post build step to the project properties-

copy "$(ProjectDir)app.config"
"$(TargetDir)YourTestAssemblyName.dll.config"
 
Back
Top