Unit testing the app.config file with NUnit

后端 未结 13 2301
夕颜
夕颜 2020-12-04 16:37

When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program re

13条回答
  •  佛祖请我去吃肉
    2020-12-04 16:48

    You can always wrap the reading-in bit in an interface, and have a specific implementation read from the config file. You would then write tests using Mock Objects to see how the program handled bad values. Personally, I wouldn't test this specific implementation, as this is .NET Framework code (and I'm assuming - hopefully - the MS has already tested it).

提交回复
热议问题