如何获得对模拟对象的调用计数?
在测试中的某个特定点,我想获取某个方法的当前调用计数,然后继续测试并最终验证该方法是否被再次调用。
这将是这样的:
[given([mockA interestingMethod]) willReturnInt:5];
<do some work that may call 'interestingMethod' one or two times>
NSInteger count = currentCountOfInvocations([mockA interestingMethod]); //or something similar
<do some more work that [hopefully] calls interesting method one more time>
[verifyCount(mockA, times(count + 1)) interestingMethod];