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
Hi, I have a method
public  void DontCallAMethod()
{
 
 if(myNum == 3)
   return;

Utility. NextMethodPlease();

}




I want to verify that Utility. NextMethodPlease(); is never, ever called. How to do this in TypeMock?
________
BMW M102 history
asked by nsoonhui (59.1k points)

3 Answers

0 votes
Hi,

With Natural Mocks, you need to use FailWhenCalled:
using (RecordExpectations rec = RecorderManager.StartRecording() )
{
    Utility.NextMethodPlease();
    rec.FailWhenCalled();
}


And with the upcoming version of AAA syntax supporting static methods, you can use Isolate.Verify.WasNotCalled. You can use it today for instance.
answered by gilz (14.5k points)
0 votes
Hi,

With Natural Mocks, you need to use FailWhenCalled:
using (RecordExpectations rec = RecorderManager.StartRecording() )
{
    Utility.NextMethodPlease();
    rec.FailWhenCalled();
}


And with the upcoming version of AAA syntax supporting static methods, you can use Isolate.Verify.WasNotCalled. You can use it today for instance.


Hi, may i know when the version that supports static methods will come up? I am looking forward to it.
________
Mercedes-Benz W221
answered by nsoonhui (59.1k points)
0 votes
Hi
The AAA syntax will support static methods in the up coming version
which will be out in the middle of next week.
answered by ohad (35.4k points)
...