I am trying to setup a OCMock to be verified.
I have a protocol, TaskManagerDelegate
, that contains the following method,
- (void) addTasks:(NSArray * ) tasksToAdd;
After setting up my mock object like this,
id mockTaskManagerDelegate = [OCMockObject mockForProtocol:@protocol(TaskManagerDelegate)];
I assign the object to the class under test like this,
taskManager.Whatever = mockTaskManagerDelegate;
I call a method on my taskManager and then want to verify the addTasks method was called on the TaskManagerDelegate and that the array that was passed to it contains exactly one object.
So far I have used the OCMArg class to detect if a parameter is being passed in, but I am struggling to understand how to check that specific types are sent are sent to the mocks, or that the objects sent to mock pass certain tests (have a .count of exactly one for a example). I come from a C# background and would normally use Moq, where you can use lamda functions to do specific checks on parameters being sent to the mocked object.
Does any one know how to do this with OCMock or if for some conceptual reason it is not possible to do?
Thanks,