开发者

Objective C - How to use OC Mock?

开发者 https://www.devze.com 2023-02-21 02:08 出处:网络
I hav开发者_Python百科e a class that suppose to return a string when a method gets called. How can i create a mock object.

I hav开发者_Python百科e a class that suppose to return a string when a method gets called. How can i create a mock object.

I want mock to return @"Hello" when the method "sayHello" get's called

id mock = [OCMockObject mockForClass:[MyCrazyClass class]];


[[[mock stub] andReturn:@"Hello"] yourMethod:someArgument];
0

精彩评论

暂无评论...
验证码 换一张
取 消