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
0 votes
I have the following class:
public abstract class Command
{
   public Command()  { }
   public void Execute()
   {
       InnerExecute();
   }
   protected abstract void InnerExecute();
}

and The following test:
[TestMethod]
   public void Execute_StandardExecution_InnerExecuteWasCalled()
   {
       var fakeCommand = Isolate.Fake.Instance<Command>(Members.CallOriginal);
       fakeCommand.Execute();
       Isolate.Verify.NonPublic.WasCalled(fakeCommand,"InnerExecute");
   }


running this test result in:

Test method Crap4NetTests.BasicCommandTest.Execute_StandardExecution_InnerExecuteWasCalled threw exception: TypeMock.VerifyException:
TypeMock Verification: Method Mock0000Command.InnerExecute() was expected but was not called.

any idea why this is so?

:!: making InnerExecute public and using "regular" verify seems to work just fine
asked by error (6.6k points)

3 Answers

0 votes
Hi Lior,

Unfortunately you're right and this is a bug with recording calls on non public abstract methods. The workaround as you mentioned it is either use normal verify or use non-abstract methods - not very satisfactory, I know :cry: . I'll update this thread when we resolve this bug.

Doron
Typemock Support
answered by doron (16.5k points)
0 votes
HI Doron,

Any update on this issue?
I'm really stuck with this thing
answered by error (6.6k points)
0 votes
Hi Lior,

Currently this is a known issue, I will update you (and this thread) when we solve it.
answered by dhelper (11.9k points)
...