开发者

How to run this test in NUnit

Why in NUnit when i write : Assert.AreEqual(ConfigurationManager.ConnectionString开发者_开发技巧s["FertigungRead"].ConnectionString , "Data Source=server511;Initial Catalog=FERTIGUNG;Persist Security Info=True");

it does not run the test and raises an error : Object reference not set to an instance of an object.

But ConfigurationManager is static class. So how can i run this test?


It is running the test - but the test is failing, because ConfigurationManager.ConnectionStrings["FertigungRead"] is returning null. See this post about app.config files an NUnit, as that's where it'll be getting the configuration from.

However, I don't really see a test for a config file value as a valuable unit test... is this part of a more reasonable test?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜