tags:

views:

47

answers:

2

Given this set of code:

unitTestConfiguration = (IDictionary) ConfigurationManager.GetSection("unitTestSection");

where can you determine which project this file should exist in.

I am trying to run a bunch of unit tests but they are failing because it can't find any file

A: 

It's looking for the application configuration file. These reside in your project under the name App.config (or Web.config for ASP.NET) and are compiled into YourApplicationName.exe.config.

Here is an MSDN page on adding an App.config file to your project.

Here is an MSDN page on the Configuration class.

Jason
+1  A: 

For a web application, this reads from the web.config file.

For an executable, this reads from exename.exe.config for the entry point assembly (the one that contains the Main method). This is an important distinction that the config file it reads from is the entry point assembly, not the assembly that contains the particular line of code.

binarycoder