Hi,
I've been trying to mock an event that looks like this:
public event EventHandler<SomethingEventArgs<TParam>> MyEvent.
with a line that looks like this as I want to fire the event during the test to trigger behaviour:
Isolate.WhenCalled(() => stubObject.MyEvent += null).CallOriginal();
But every time the above line is reached I get the following error message:
Test method MyTestMethod threw exception: System.IndexOutOfRangeException: Index was outside the bounds of the array..
And the stack trace:
gn.a(Type A_0, Type[] A_1, Type[] A_2)
gn.a(Type A_0, Int32 A_1, Type[] A_2, Type[] A_3)
gn.a(IList`1 A_0, Type[] A_1, Type[] A_2)
gn.a(Object A_0, MethodBase A_1, Object[] A_2)
gn.a(MethodBase A_0, Object A_1, Type A_2, Object[] A_3, Object A_4)
gn.a(MethodBase A_0, Object A_1, Object[] A_2, Object A_3)
fl.b(Object A_0, String A_1, String A_2, MethodBase A_3, Object[] A_4, Object A_5)
add_MyEvent(EventHandler`1 value)
b__1() in C:DevMyTests.cs: line 69
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
MyTestMethod() in C:DevMyTests.cs: line 0
I've changed names to protect the innocent :)
We're still using 5.4.3 as upgrading breaks the majority of our tests which we're awaiting support on.
Thanks,
John