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
Hello,

My team has encountered what seems like a bug after we updated to TypeMock version 7.5.1. We're using Visual Studio 2013, update 2. We've recently switched from using .testsettings file to .runsettings file in order to make use of the new and faster test run engine. This has worked well with the older version of TypeMock (7.2.0) but since we've updated to version 7.5.1, we've been getting an exception that doesn't seem to make sense.

It occurs in the following line of code:

Isolate.WhenCalled(() => PropertyBagHelper.GetPropertyValue<string>("some constant")).WithExactArguments().WillReturn(someString);

The exception:

TypeMock.ArrangeActAssert.NestedCallException:
*** WhenCalled does not support using a method call as an argument.
- To fix this extract the call for AssemblyResolver.SearchAndLoadAssembly() to a variable and pass it instead

***
* Example - this would work:
- MyObj argument = Something.Other().GetStuff();
- Isolate.WhenCalled(() => ObjUnderTest.MethodUnderTest(argument))...;
***
* Example - this would not work:
- Isolate.WhenCalled(() => ObjUnderTest.MethodUnderTest(Something.Other().GetStuff()))...;

This doesn't make sense to me, because I'm obviously not trying to pass a method call as an argument. I'm simply passing a string constant. What's even more strange is that this exception only occurs in some of the tests and not others, even if they share the same code. For example, we have a test class with several test methods, and the line of code is in a helper method they all use. But the exception only occurs in one of the tests, others run fine.
In another case this line is in a base class, which is extended by 17 test classes (each have one test method). 15 methods pass, 2 fail with the same exception (always the same 2 tests). Isolate.Cleanup() is used to assure clean-up between tests.

If I debug the failed tests, another exception occurs on the same line:

*** No method with name MyMethod>b__2d in type MyNamespace.MyClass exists.

where MyMethod is the method that contains the line, and MyClass is the class containing the method. If I move the line to another method, I get the same exception in the new method. If I continue execution, this exception is immediately followed by the aforementioned exception : *** WhenCalled does not support using a method call as an argument

I've tried updating to TypeMock version 7.5.2., and installing update 3 to VS2013. Neither update helped.

The tests work fine when we revert to using .testsettings file for configuration, or when we set the ForceLegacyMode to true. However, this negates the effects of using the .runsettings file, and forces us to use the older, slower engine. Therefore it's only acceptable as a temporary workaround.

Any advice would be appreciated. I'll provide any additional information if necessary, except for the source code, as it is considered sensitive client data.

Thank you in advance for your help.
asked by AAA_Team (600 points)

2 Answers

0 votes
Hi,

Thank you for the feedback.
We're looking into this.
I'll update you ASAP
answered by alex (17k points)
0 votes

Hi,

I’ve attached link to our new version– just run the installer and you should be good to go.

Let us know if it solved the problem.

Edit: Solved in V8.

 

 
answered by Bar (3.3k points)
edited by Bar
...