The problem with NUnit and app.config

前端 未结 9 833
孤独总比滥情好
孤独总比滥情好 2020-12-29 19:48

When i run a simple test on connection to DB check i receive an error in NUnit:

[Test]
public void TestConn()
{
    string  connectionString = Configuration         


        
9条回答
  •  长发绾君心
    2020-12-29 20:34

    Yes, you can. You need to be sure that any configuration you are referencing in your tests actually exist in the app.config of the test project.

    In other words, the project where your test is in, does not have a connection string "FertigungRead" defined in its app.config.

    One way to do this is to add the app.config of the system under test to the test project as a link, this way any changes happen on both projects.

提交回复
热议问题