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

+3 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: http://pastebay.com/pastebay.php?dl=77544

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

4 Answers

+1 vote
Neil,

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.

Thanks,
Doron
Typemock Support
answered Dec 20, 2009 by doron (26,680 points)
+3 votes
Thanks Doron.
answered Dec 20, 2009 by Neil (9,200 points)
+2 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.

Regards,
Elisha,
Typemock Support
answered Dec 20, 2009 by Elisha (22,740 points)
+3 votes
Thanks Elisha.
answered Dec 20, 2009 by Neil (9,200 points)
...