Reputation: 15303
Currently for a number of my unit tests I require that some configuration be pulled from a file. Initially I thought I only needed to add Test Settings to my unit testing project and configure this in Test Settings->Deployment. I added my config file here but my unit tests were still complaining that they couldn't find this config file. Finally I found that I needed to add the [DeploymentItem("Test.config")] attribute to any of my unit test classes that needed this.
Is this how it's supposed to be done? It seems like I should not have to use the DeploymentItem attribute. Am I doing something wrong here?
Upvotes: 2
Views: 2730
Reputation: 3091
set the config file to copy to the output directory in a post build
Upvotes: 1
Reputation: 22368
Do you mean that your code under test requires a config file? Then you can add a regular app.config to your unit tests. Well in all other cases you can use that as well.
Upvotes: 2