The configuration settings always reads from the .config of the EXE the
.dll is running in. In this case, NUnitGUI.exe or Nant.exe
Anyone know of a way to explicitly set the config file to read from?
How can I get access to a web application’s
ConfigurationSettings.GetConfig() from within an NUnit test? It
appears that NUnit is accessing its own configuration settings.
Running this test:
[Test] public void TestGetConfig()
NameValueCollection configSettings = NameValueCollection)ConfigurationSettings.GetConfig(“appSettings”);
Console.WriteLine(“Exception” + ex.ToString());
configSettings gets an “undefined value,” I get a
How can I retrieve my appSettings from a simple NUnit test?
I seem to remember reading somewhere that the config file has to be in the
same directory as the dll that Nunit is loading, and that it has to be named
You are right. I am in the process of restructuring an open source project
called Draco.NET, and need to test configuration section loading for a core
assembly that is loaded into a service. Since configs are for app domains,
they dont directly map to library assemblies. Adding an app.config to the
library assembly project does not achieve the same effect when adding the
config to an executable assembly – the app.config is not copied into the bin
directory. But as you advise Bob, if you create an app config file with the
name of your dll
, copy it into the bin directory
manually, you will be able to access it as normal. Having the test rig copy
the config file into the bin directory is trivial.
site : http://www.fromconcept.co.uk
blog : http://www.fromconcept.co.uk/weblog.aspx