jeudi 17 décembre 2015

Use Web.config instead of app.config for integration test in ASP.NET MVC app

I have a web app which contains a project called EnterpriseInfrastructure with a class called Pager. This class simply creates a PagerClient specified by a WSDL which is linked in a service reference.

When I run the application in production, the PagerClient is initialized with settings from the Web.config from the application. That works great. But when I try to perform an integration test to make sure we have the correct endpoints specified in the Web.config, an exception is thrown that the configuration file is not found. The service is looking for the app.config--not the web.config.

Is there a way to run the test in the same way as our web app, so that the web.config is called upon rather than the app.config?

I am using [DeploymentItem(@"../../../UI/Web.config")] to copy the web.config from our actual project.

Aucun commentaire:

Enregistrer un commentaire