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've already spent a good chunk of the day but get no traction in figuring out this one. In the code below I try to swap a method with another in my test. I'm running this within the VS2010 IDE debugger.

1. if I just run the unit test, I'm getting a TypeMock.ArrangeActAssert.NestedCallException on the Isolate.WhenCalled line that swaps the method.

2. if I debug the unit test and set a breakpoint on the Isolate.WhenCalled line and try to step over I get the same exception. So far so good, although I cannot see where does the nested call come from.

3. here is the best one: I repeat the steps in 2, but before stepping over the Isolate.WhenCalled line I hover over the mock variable and expand it in the debugger's Quick View, no exception happens.

Thank you, eugen


var mock =
Isolate.Fake.Instance<SmartcardService>(Members.CallOriginal,
ConstructorWillBe.Called,
this.workItem);

CancellationToken token = CancellationToken.None;

Isolate.WhenCalled(() =>
mock.ReadCertificates(string.Empty, token)).
DoInstead(callContext =>
{
return ReadTheCertificates((string)callContext.Parameters[0],
(CancellationToken)callContext.Parameters[1]);
});
asked by eugen_nw (1.2k points)

1 Answer

0 votes
Eugen,

Thank you for the recreating test. Basically, a NestedCallException means that you are nesting calls inside a WhenCalled() statement, such as WhenCalled(() => A.B(C.D()))... This does not seem to be what is happening in this case, so this seems like a bug. We'll investigate and get back to you.

Doron
Typemock Support
answered by doron (17.2k points)
...