mercredi 27 janvier 2016

Connection strings not available from App.Config in Unit Tests run on TFS 2015

I'v some DB facing unit tests that take their connection string from an app.config file. I'm grabbing the strings thru ConfigurationManager class.

var conString = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;

The tests run fine on dev machine but not on TFS. There is a null refernce error. If I jsut replace the connection string in unit test with a hard coded string - identical to that in app.config - then the test works. Oh yeah, and I've made sure that app.config is set to "copy to output folder".

Is there a known issue with TFS and ConfigurationManager?

pom

Aucun commentaire:

Enregistrer un commentaire