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

I'm writing a test against a section of code where 2 separate calls are made against a data layer class with the static methods Exists and Find. I'm mocking the calls using Isolate.WhenCalled(); what seems to happen is that when I add the Isolate.WhenCalled() for the second method call (Find, in this case), it causes the first Isolate.WhenCalled() (for Exists) to be ignored (so I'm obviously getting errors related to database connectivity).

What I'm wondering is if this is pilot error; intended behavior; a bug; or more specifically, what I can do to work around the problem.

TL;DR: When using Isolate.WhenCalled(), it seems you can only use it once against a static object (in my case a data layer), even if the methods being mocked (such as Find/Exist) are different.

Thanks for the help,

Paul
asked by Schoens (640 points)

3 Answers

0 votes
Hi Paul,

Your expectations are correct - WhenCalled should not behave like this. Can you post the test code and static class code here? That would help understand if this is a bug or as you say, pilot error.

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
0 votes
It would probably be easier if I can send the .cs files as an attachment somewhere, since I would like to send you 3 separate files (so you can see what all is happening during the test). Could you provide me with your email, or a place to post them?

Thanks,

Paul[/code]
answered by Schoens (640 points)
0 votes
Paul,

Let's take this offline then. Please send the file(s) to support at typemock.com.

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