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
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

This test does not throw a NestedCallException as expected

0 votes
This test throws an IndexOutOfRangeException because .Matching() tries to match the first argument to "a.B", which has zero arguments, when what the user wants is to match the first argument to "a.B.BMethod()". I expect a NestedCallException here instead of an IndexOutOfRangeException.

[ img ]
Code for the above:

How to make the IndexOutOfRangeException go away:
[ img ]
asked Dec 19, 2009 by Neil (27,740 points)

4 Answers

0 votes

I'll need to take a close look at this. It seems to me that the result should be the same for both tests, and certainly not the IndexOutOfRangeException you received. Let us check this out and get back to you.

Typemock Support
answered Dec 19, 2009 by doron (16,520 points)
0 votes
Thanks Doron.
answered Dec 19, 2009 by Neil (27,740 points)
0 votes
Hi Neil,

Thanks for reporting. The VerifyWasCalled with Matching does not support chained calls. It should have stated this in the exception but it didn't and it's a bug.

The solution is as you showed in the example - store the chain in variable before performing the verification.

Typemock Support
answered Dec 20, 2009 by Elisha (12,040 points)
0 votes
Thanks Elisha.
answered Dec 20, 2009 by Neil (27,740 points)