I'm using OCMock
to verify that some delegates methods are correctly called but it is not working even if I call them explicitly from my test code
id protocolMock = OCMProtocolMock(@protocol(NMARouteManagerDelegate));
sut.delegate = protocolMock;
[sut.delegate routeManager:sut skippedRouteForTransportMode:1];
OCMExpect([protocolMock routeManager:sut skippedRouteForTransportMode:1]);
OCMVerifyAllWithDelay(protocolMock, 1);
This fails with the error
expected method was not invoked: routeManager: skippedRouteForTransportMode:1
It works fine though if I use a synchronous verification:
OCMVerify([protocolMock routeManager:sut skippedRouteForTransportMode:1]);
In my real test, I need the verification to be done asynchronously with OCMVerifyAllWithDelay