views:

87

answers:

1

Hello -

We have a solution that comprises several projects. I came on not too long ago, and started adding functionality to one of the projects. We are using the Enterprise Library 3.1 Logging Application Block for logging.

We have been talking about Unit Testing (who hasn't) but haven't tried to add it until today. I decided to use the test framework built into Visual Studio 2008, rather than installing something else. Once I got past the Strong Name issues so everything would compile, I get the following error when I try to run it:

ConfigurationErrorsException was unhandled. The configuration section for Logging cannot be found in the configuration source.

Obviously, the Logging section is still present in the app.config file for the project under test, so what is needed? There is no executable in the test project, so what config file do I need to be looking for?

Thanks, Dave

+1  A: 

You test project needs to have an app.config file with the correct configuration to run.

Looks like your codebase is tightly coupled to the configuration, so unit testing is difficult without duplicating the configuration in the test project.

Oded
So I can duplicate the app.config file to the test project and it should work? Trying that now...
DaveN59
You could also "add an exisiting item" via the VisualStudio right click on the project and when press the "add-button" press the right arrow and select "add as link". This adds a link to you original App.Config.
tobsen
That works. For some reason, I was thinking it needed to be associated with the exe...
DaveN59
The "add as link" feature is cool, thanks for pointing that out...
DaveN59