I have an interface
public interface IMyInterface
{
[CustomAttribute]
void MethodA();
}
and the corresponding class implementing it
public class MyClass: IMyInterface
{
public void MethodA()
{
//<some logic>
}
}
I am using StructureMap.AutoMocking, when I create a Test case :
var mocker = new RhinoAutoMocker<IMyInterface>(MockMode.AAA);
it throws an exception along the lines of -
System.TypeInitializationException' in MY DLL NAME
Additionally the type initializer for CustomAttribute threw an exception.
public class CustomAttribute : AuthorizeAttribute
{
internal bool TestAuthorizationIsEnabled;
internal bool IsAuthorized(string name)
{
var auth = new Auth();
var val = auth.IsAuthorized(name, Roles);
return val;
}
}
How to fix this error?