I have an interface definded like this:
public interface IDatabase{ void Get<TTypeToFetch> ();}
and when I try to do:
Mockery mockery = new Mockery();
IDatabase db = mockery.NewMock<IDatabase>();
I get the following error:
System.TypeLoadException: System.TypeLoadException: Signature of the body and declaration in a method implementation do not match
What is wrong? (I am using Visual Studio 2008 with nmock2)
Please could everyone give me an answer, I have to finish this soon.
Thanks,
Luisa
I think this may be a problem with NMock, possibly even a bug. The type
IDatabaseis not generic, so when you invokeGet<T>, differentTs could be used at runtime. But when NMock is generating the mock, it doesn’t appear to understand that this is the case, and kablammo — each method signature is different, depending on the type parameter supplied.Try doing this instead:
Also, shouldn’t the type of
GetbeT, notvoid?