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 Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

Is there a way to specify args on WhenCalled

0 votes
Looking for a work around for the following: ... =4864#4864
asked Feb 27, 2009 by boo (21,780 points)

6 Answers

0 votes
Hi Boo,

To follow up on other recent forum postings related to this: this feature (conditional behavior) is in our todo list and will be implemented for an upcoming version. In the meanwhile, you could use one of our older APIs to do this - this page describes how you do it in Natural Mocks: ... tural.html. You can find that and more under our user's guide at, under Using Typemock Isolator -> Previous Generation API. Again, we are committed to bring this capability to the AAA API.

Typemock Support
answered Feb 28, 2009 by doron (16,520 points)
0 votes
What is the time frame on this? I've spent the entire morning trying to get this to work in Natural and it's just been painful so I tried using a combination of reflective and AAA but that's not working either (mock.MockedInstance is returning null).

If it's going to be in the next 2-3 weeks I can live with an inconclusive test or two versus spending much more time trying to work around.

I'm assuming this new feature would be bundled with the feature of WasCalledWithArguments feature that would allow you to have that When logic of reflective mocks in AAA --- which is where I really need it.
answered Mar 4, 2009 by boo (21,780 points)
0 votes
Hi Brian,

Conditional Behavior feature is one of the next features that will be added to Isolator's AAA API, at this time I cannot give you exact estimate but I hope it will be available the next month.
answered Mar 5, 2009 by dhelper (11,900 points)
0 votes
Here's the work around I implemented for this lack of feature: ... eters.aspx
answered Mar 5, 2009 by slace (2,380 points)
0 votes
Unfortunately in my case it's not as clear cut of a problem, but good tip and thought though to use extension methods.
answered Mar 5, 2009 by boo (21,780 points)
0 votes
Yeah, it's only useful if you can practically implement an extension method for what you are mocking (which I was able to do).

Otherwise we've got to wait until Typemock can get it implemented within the API ;)
answered Mar 5, 2009 by slace (2,380 points)