0
조롱 된 객체에 대한 호출 횟수를 어떻게 얻을 수 있습니까?OCMockito가 모의 호출에 대한 카운트를받습니다.
테스트의 특정 시점에서 특정 메소드에 대한 호출의 현재 카운트를 얻고 테스트를 계속하고 마지막으로 메소드가 한 번 더 호출되었는지 확인합니다.
[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];