我正在做一个单元测试,测试我的连接字符串。这是我的测试方法中的代码:
[TestMethod()]
public void connectionStringTest()
{
//string expected = null; // TODO: Initialize to an appropriate value
string actual;
string expected = " User Id=ownitsbio;Password=ownitsbio;Data Source=preprod";
actual = ConfigurationManager.ConnectionStrings["ownitsbio"].ConnectionString;
Assert.AreEqual(expected, actual);
//Assert.Inconclusive(expected);
}
我得到这个错误System.NullReferenceException: Object reference not set to an instance of an object
。可能是什么问题呢??请帮忙!