我想使用OCMock,以便每当使用任何参数调用someMethod
时,它会使用参数" dict"调用callBackMethod:
,这是NSDictionary
。我找到了andCall:onObject:
,但似乎没有让你通过论证。有没有办法达到这个理想的行为?
答案 0 :(得分:1)
您可以使用andDo:
并在给定的块中执行您想要的任何内容。
id yourMock;//...
NSDictionary *dictionary;//...
id anObject;//...
[[[yourMock stub] andDo:^(NSInvocation *invocation) {
[anObject callBackMethod:dictionary];
}] someMethod];