This may or may not be a multi-interface problem, 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 );
On the DoSomething line at runtime I get:
MyTest (TestFixtureSetUp): System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.TypeInitializationException : The type initializer for 'IInterface1Proxy184f83d417624e05b450fa40c2c5d35c' threw an exception.
----> System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Does this have something to do with my not having the right Expect code, or is it related to the multiple interfaces in my mock, or something else?