chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
After a bit of searching the forums I believe this specific exception is a bug, but none of the solutions provided fix the underlying problem in my situation.

The static method I'm verifying is overloaded.

These are the relevant lines of code:
//do stuff
Isolate.Verify.WasCalledWithArguments(() => TISServicesHelpers.UpdateIndirectFulfilmentRequestRecord(
        EFulfilmentRequestStatusEnum.Cancelled)).Matching(args => (EFulfilmentRequestStatusEnum)args[1] == EFulfilmentRequestStatusEnum.Cancelled);

Adding an explicit WhenCalled for that static method did not help:
Isolate.WhenCalled(() => TISServicesHelpers.UpdateIndirectFulfilmentRequestRecord(0, EFulfilmentRequestStatusEnum.Cancelled)).IgnoreCall();

I can get the exact arguments Verify method to work however:
Isolate.Verify.WasCalledWithExactArguments(() => TISServicesHelpers.UpdateIndirectFulfilmentRequestRecord(

However I was hoping not to use this.

Any suggestions? Thanks in advance.
asked by bflan (760 points)

9 Answers

0 votes

I tried to reproduce the exception you got without succes :(
Can you please post the prototype of the other overloaded method?
answered by ohad (35.4k points)
0 votes
Hi ohad,

public static void UpdateIndirectFulfilmentRequestRecord(long indirectFulfilmentRequestSk, EFulfilmentRequestStatusEnum fulfilmentRequestStatus)

public static void UpdateIndirectFulfilmentRequestRecord(IndirectFulfilmentRequest request, EFulfilmentRequestStatusEnum fulfilmentRequestStatus)

Full info:
System.IndexOutOfRangeException : Index was outside the bounds of the array.
at Test.TISServices.TISWebServiceTests.<FulfilmentUpdate_UnexpectedVoidOrCancellation_HelperRequestRaisedProductAccountUpdated>b__2e(Object[] args) in C:ClearCaseflanaga_SSW_developmentGMPTE2005PackagesWebTISServicesTestTISWebServiceTests.cs:line 228
at ht.a(Predicate`1 A_0)
at gl.a(Predicate`1 A_0)
at a4.a(Predicate`1 A_0, MethodBase A_1, Object A_2, TypeParams A_3)
at dm.a()
at ab.a(jm A_0, ae A_1, hr A_2, Predicate`1 A_3)
at b4.a(Predicate`1 A_0)
at Test.TISServices.TISWebServiceTests.FulfilmentUpdate_UnexpectedVoidOrCancellation_HelperRequestRaisedProductAccountUpdated() in C:ClearCaseflanaga_SSW_developmentGMPTE2005PackagesWebTISServicesTestTISWebServiceTests.cs:line 226
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType)
at Test.TISServices.TISWebServiceTests.FulfilmentUpdate_UnexpectedVoidOrCancellation_HelperRequestRaisedProductAccountUpdated() in C:ClearCaseflanaga_SSW_developmentGMPTE2005PackagesWebTISServicesTestTISWebServiceTests.cs:line 0

It might not be relevant, but there are two calls to that method being verified during the test
answered by bflan (760 points)
0 votes
Sorry I still can not reproduce the error :(
Is it possible to send a small solution that reproduces the problem to out support (support at
answered by ohad (35.4k points)
0 votes
I just spent some time doing that but unfortunately when trying to reproduce the logic in a small simulation the tests pass without issue.

There must be something about that particular method as I'm doing lots of similar things with other similar methods without problems.

I don't know if this is a clue or not, but I have another test failing with the same method where I attempt to Verify that it was NOT called in a scenario where it shouldn't be. I've stepped through the test during the Act step and confirmed it does not call the method, but during the Verify step when I use WasNotCalled, Isolator tells me that it infact was.

Does this ring any bells?
answered by bflan (760 points)
0 votes

I suggest that we'll do a remote desktop session to find the problem
Is it possible?
answered by ohad (35.4k points)
0 votes
I can't get authorisation for that at the moment.

The behaviour of the Verify.WasNotCalled I'm seeing, has that been seen before?

Some debugs steps I've taken:
1. Commented out every call to the overloaded static method that I'm verifying is not called, Verify.WasNotCalled still fails saying the method was called.
2. Set up DoInsteads on the method, WasNotCalled fails having never hit the do instead.
answered by bflan (760 points)
0 votes

Is it possible for you to post a complete test code? We can try to recreate the methods by their signature, instead of seeing their actual implementations... This is not guaranteed to recreate the issue though.

Typemock Support
answered by doron (17.2k points)
0 votes
What do you mean by complete test code?

As mentioned I wrote a simplified dummy project to simulate the basic logic and actions of the code I'm testing, but I was unable to recreate the behaviour myself.

I'm sorry I can't provide greater access to the actual code in question to enable you to recreate it.

For the two issues, Isolate.Verify.WhenCalled throwing an IndexOutOfRange exception, and Isolate.Verify.WasNotCalled failing despite the function specified by Isolate.Verify.DoInstead never being hit, are there perhaps any suggestions you can make that might help me investigate their behaviour further?

My evaluation license has expired, is it possible to extend it in order to wrap this up?
answered by bflan (760 points)
0 votes

I sent you an extended license to the mail that you have in our forum.
My suggestion is that we'll take off line and continue from our support mail.
I'll send you a mail with suggestion how we can continue from here.
answered by ohad (35.4k points)