samedi 21 février 2015

Is it possible to use OCMock to mock both class methods and a protocol?

In the OCMock docs you can easily mock a class, OR a protocol:



id classMock = OCMStrictClassMock([SomeClass class]);
id protocolMock = OCMStrictProtocolMock(@protocol(SomeProtocol));


My question is: can you do both? Basically I want to mock out an MPMediaItem that also implements this protocol:



@protocol VBLoggableProtocol <NSObject>
/*
* Returns a string that gives a detailed description of the properites of this object
*/
- (NSString *)propertiesStr;
/*
* Returns a string that simply identifies the object (ie song.title)
*/
- (NSString *)idStr;
@end


But I have no idea how.. ideas?


Aucun commentaire:

Enregistrer un commentaire