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
+1 vote
We have coded a handful of tests, some of which use the TypeMock.Isolator.VisualBasic SwapAllInstances method. When running the tests that use SwapAllInstances individually, either the tests pass, or a different error is generated (differing for each test). When all tests are ran, the error "Can not call Swap.AllInstances() more than once on a type" is generated. Is there an issue with running multiple tests that use the SwapAllInstances Function?
asked by jdivis (1.3k points)

2 Answers

+2 votes
 
Best answer
jdivis,

Do your tests have the [Isolated] attribute? This should ensure behavior is cleaned up between tests, allowing you to declare Swap.AllInstances() again. If this doesn't help, can you post your tests here (or send them to our support email)? I'm also interested in trying to help out with the tests that fail individually.

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
selected by jdivis
0 votes
doron,

Thank you for the suggestion. Just got back to these Unit Tests, tried your Isolated() attribute and that solved the swapallinstances issue.

I was able to resolve the other issues with the tests that were being masked by the "Can not call Swap.AllInstances() more than once on a type" error.

Thank you,

Jason
answered by jdivis (1.3k points)
...