我正在尝试使用 Fitnesse 和 FitSharp 在我的 Web 应用程序的 DAL 中测试方法。我在阅读 app.config 时遇到问题。
得到错误:
System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. ---> System.NullReferenceException:
Object reference not set to an instance of an object.
at ...DAL.get_ConnectionString()
这是在吸气剂
get{
var result = ConfigurationManager.ConnectionStrings["CN1"].ConnectionString;
if (String.IsNullOrEmpty(result))
throw new NoNullAllowedException("Connection string does not exist");
return result;
}
为什么 ConfigurationManager 没有初始化?
如何配置 Fitnesse 以测试 DAL?
感谢您的任何建议