app.configs and MSTest Project - null reference for a connection string

后端 未结 3 1717
故里飘歌
故里飘歌 2021-01-12 03:11

When I try to run Unit Tests (mstest) I run into this issue.
The line of code:

_mainCnStr = System.Configuration.ConfigurationManager.
               C         


        
3条回答
  •  半阙折子戏
    2021-01-12 03:51

    I'm assuming mstests are, like nunit tests, embedded in a seperate assembly which gets loaded by the testing application? In that case, you may need to create some test set-up code which loads in the configuration file.

提交回复
热议问题