用Nunit做单元测试发现他的Bug,到底是Bug吗?请各位指教
lxw99 2005-09-12 10:15:46 本少用Nunit做测试,如下伪代码
private static string strDSN=ConfigurationSettings.AppSettings["strConnection"];
然后
conn =new SqlConnection(strDSN);
conn.Open();
Nunit居然报
===========================
LinkThink.LinkThinkTest.BusinessFactory.TestFactoryCreat.TestFactoryCreate : System.TypeInitializationException : “LinkThink.Business.NewsTypeSqlHelper”的类型初始值设定项引发异常。
------>>>>>> System.InvalidOperationException : ConnectionString 属性尚未初始化<<<--。
如果改成
conn =new SqlConnection();
conn --》》这里将连接字符串写死了就没有问题,有没有搞措啊
conn.Open();
请大家指教