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 Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I notice that in 6.0

 Isolate.WhenCalled(() => ObjUnderTest.MethodUnderTest(Something.Other().GetStuff()))


is no longer working.

But in previous version it was working.

Why this is so?
________
VAPORIZER AFFILIATE PROGRAM
asked by nsoonhui (59.1k points)

1 Answer

0 votes
Hi,

Isolator 6.0 has a new feature that identifies nested calls which are not supported in WhenCalled and Verify. Nested calls where not supported in previous versions of Isolator and led to wrong behavior recording. The new version reduces it by notifying during the behavior recording.

The correct code should be:
var arg = Something.Other().GetStuff();
Isolate.WhenCalled(() => ObjUnderTest.MethodUnderTest(arg))
                .WithExactArguments().WillReturn(...) // Specific arguments

Isolate.WhenCalled(() => ObjUnderTest.MethodUnderTest(null)).WillReturn(...) // Match all arguments

In the code the nested call result is stored in a variable before the behavior recording and avoids the nested call.

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
...