This may or may not be a problem with multiple interfaces, but I'm doing something like this:
var mockInterface1 = new Mock<IInterface1>();
var mockInterface2 = mockInterface1.As<IInterface2>();
mockInterface1.Expect( foo => foo.Foo(It.IsAny<IInterface3>() ) );
...
otherObject.DoSomething( (IInterface1)mockInterface2.Object );
In the DoSomething line at runtime, I get:
MyTest (TestFixtureSetUp): System.Reflection.TargetInvocationException: An exception was thrown by the target of the call.
----> System.TypeInitializationException: the type initializer for "IInterface1Proxy184f83d417624e05b450fa40c2c5d35c" made an exception.
----> System.BadImageFormatException: An attempt was made to load a program with the wrong format. (Exception from HRESULT: 0x8007000B)
Is it due to the fact that I did not have the correct Expect code, or is it due to several interfaces in my layout or something else?