erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

Add an invocation count detail to expectations #340

Closed patrickhartling closed 7 years ago

patrickhartling commented 7 years ago

It would be really helpful if an expectation for a method could have an expected invocation count applied to it. This would eliminate the need for multiple OCMExpect() statements to capture that behavioral detail. The basic idea would is similar to what Mocker provides.

I do not have a great idea for the syntactic form that this would take, but the most bare bones approach would probably be the following:

OCMExpect([mockObject someMethod]).andReturn(result).count(countForSomeMethod);
nikolaykasyanov commented 7 years ago

Looks like this: https://github.com/erikdoe/ocmock/pull/302

erikdoe commented 7 years ago

Yes, if you have any comments, please add them to #302. I couldn't make up my mind and there was very little feedback so I still haven't merged it. Maybe I should add a note to the ocmock.org site... In any case, I'm closing this as a duplicate.