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 realise that this is not a feature at the moment, I was wondering if this is planned to go in, and if so, when?

To be clear, the issue I have is that if you place a ExpectAlways or AlwaysReturn on a MockAll mock, then it doesn't work for instance mocks that are created later. I'd like for TypeMock to check if there is an expectation for a particular method in the MockAll mock if the instance mock doesn't explicitly expect it.

Basically I'm trying to do something like this:

1) Create an instance mock and stub all methods (either ExpectAlways, or AlwaysReturn with a default return value)

2) Specify particular return values for a chosen method on all instances of the same type.

3) Have subsequently created mock instances of that type inherit the return values specified in 2.

I can do 1 and 2 (by adding the expectation into any existing mock instances), but not 3. Is there any way to achieve this currently?

Cheers,

Rory.
________
buy vapormatic
asked by rorydriscoll (3.8k points)

1 Answer

0 votes
Hi Rory,

We had several requests to do defaults and fallbacks. So this is on our feature backlog. As always, I would like other people to chime in regarding about the usefulness of such a feature, so we can prioritize it accordingly.

By the way, you can do the following topic in the Help file: Repeating Expectations in Natural TypeMock. You can use Repeat to override RepeatAlways.

Let me know if this works out for you.
answered by gilz (14.5k points)
...