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

I recently moved from TypeMock 6.0.8 to 8.1.1.11, and I've run into a behavior difference that causing tests to fail.  I have many tests that mock methods with out parameters.  They set the out parameter by establishing the expected value in the Isolate call:

string theValueIWantClientsToGet = "thisValue";
Isolate.WhenCalled(() => someMock.TryGet(out theValueIWantClientsToGet)).WillReturn(true);

The first call to TryGet will set the out parameter as I expect.  The second call on ends up setting the out parameter to null.

I can work around this issue by changing to:

string theValueIWantClientsToGet = "thisValue";
Isolate.WhenCalled(() => someMock.TryGet(out theValueIWantClientsToGet)).DoInstead(
    context =>
    {
        context.Parameters[0] = theValueIWantClientsToGet;
        return true;
    });

While this does resolve the issue, as a company we have thousands of existing tests, and we'd rather not have to #1 find all these cases and #2 modify test code that used to work.

Thanks,

-Kevin

asked by kevinms99 (4.4k points)

1 Answer

0 votes
It reproduces so I can confirm that this is bug.

I'll update here on the status.
answered by alex (17k points)
...