1
我想用Fitnesse和FitSharp在我的web應用程序的DAL中測試方法。我在閱讀app.config時遇到問題。如何配置Fitnesse以測試DAL?
四處錯誤:
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;
}
Why ConfigurationManager is not initialized?
How to configure Fitnesse for testing DAL?
Thanks for any advice
感謝。有用。我只是想補充一點,app.config與fit runner區分大小寫。標籤ConnectionStrings必須以小寫開頭: –