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!
0 votes
My case may looks wired. I'd like to have a Mock object constructed, but only part of instance member functions are mocked, while other instance member functions are original. For example, one mock instance is constructed to replace Dummy class instance. Dummy class has two instance member functions: Smile and Cry. Invocation to Smile of mock instance is intercepted; and invocation to Cry method is not intercepted and is original function call.

class Dummy
{
public void Smile()
{
}

public void Cry()
{
}
}
asked by (600 points)

3 Answers

0 votes
Hi
Can you please post the test code?
answered by (35.4k points)
0 votes
answered by (11k points)
0 votes
Hi,

After rereading your post we are not really sure what you are trying to accomplish.

By default "Unexpected calls" (i.e. calls that have no expectation set on them) are executed by the "real" code. the exception for this rule are interfaces/abstract classes which has no "real" code and calling unexpected methods will end in an exception thrown.

So, if I understand you correctly the behavior you need should be the one you see by default.
Since this is not what you see, try using the StrictFlags Enumeration as Paulo suggested and if still thing does not work for you, try posting you test code and as much of the code under test as you can.
answered by (13.2k points)
...