I am trying to test method in DAL of my web application with Fitnesse and FitSharp. I am having problems with reading app.config.
Getting error:
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()
This is in getter
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
I believe you'd need to make Fit Sharp aware of your App.config file:
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