1

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 が初期化されないのはなぜですか?

DAL をテストするための Fitnesse の設定方法

アドバイスをありがとう

4

1 に答える 1

1

FitSharpにApp.configファイルを認識させる必要があると思います。

c:\program files\fitsharp\runner -a c:\mypath\myapp.exe.config
   -c c:\myfolder\mysuite.config.xml
   -r fit.Runner.FolderRunner,c:\program files\fitsharp\fit.dll
于 2012-12-13T22:40:55.703 に答える