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

I am writing a very simple test to verify that a private method is called when a public when is invoked.

Below is a sample that illustrates this.

using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using TypeMock;
using TypeMock.ArrangeActAssert;

namespace UnitTests
    public abstract class Foo
        public void DoIt()

        protected void privateDoIt()

    public class FooFixture
        [Test, Isolated]
        public void TestDoIt()
            var f = Isolate.Fake.Instance<Foo>(Members.CallOriginal);

            Isolate.Verify.NonPublic.WasCalled(f, "privateDoIt");



It seems simple enough but each time I run this test I unexpectedly get the following error:

TypeMock Verification: Method Mock0000Foo.privateDoIt() was expected but was not called

After toying with it I discovered that if I change the method accessibility from private to protected it works the way I would expect, that is to say it succeeds.

Can someone tell me what I might be doing incorrect?

I am using Isolator v5.3.0 on VS2008 with TestDriven.NET 2.19.2409.


asked by Darin_Creason (3.5k points)

5 Answers

0 votes
Hi Darin,

You are doing things right. What you see is a bug :oops:
We will fix that and I'll let you know once the patch is ready.
answered by ohad (35.4k points)
0 votes
I was wondering what progress is being made on this bug, as I just encountered it while writing a unit test. I did notice that this bug only occurs if the class being faked is declared as abstract. Concrete classes work fine under this same scenario.

answered by bhunter (3.4k points)
0 votes
Hi Brian,

Unfortunately, I have not heard anything about this bug since I posted it. :(


answered by Darin_Creason (3.5k points)
0 votes
Brian, Darin, I have a feeling you are both in for a pleasant surprise soon :) Stay tuned.

Typemock Support
answered by doron (17.2k points)
0 votes
Hi All,

The bug has been fixed and it will be included in the next version of Isolator.

Best Regards,
Typemock Support Team
answered by Elisha (12k points)