erikdoe / ocmock

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

mock a struct #301

Closed LinkRober closed 8 years ago

LinkRober commented 8 years ago

I want to pass parameter which is kind of CGPoint. I try to use [OCMArg any] ,OCMOCK_VALUE. but it is useless.like this [[collectionViewMock expect] setContentOffset:OCMOCK_VALUE(NSMakePoint(0,0)) animated:[OCMArg any]];

erikdoe commented 8 years ago

The use of any is not possible. Please see section 4.1 and 4.2 in the documentation for details and a possible workaround: http://ocmock.org/reference/#argument-constraints

LinkRober commented 8 years ago

Thx,I got it

LinkRober commented 8 years ago

I hava a enmu:

typedef NS_ENUM(NSUInteger, MSImageCollectionViewType) {
    MSImageCollectionViewFoodType = 0,
    MSImageCollectionViewNormalType = 1,
};

and I want to return a enum value when stub [[[mock stub] andReturnValue:MSImageCollectionViewNormalType] collectionType]; but, I can't get a correct value.why? @erikdoe

erikdoe commented 8 years ago

Please ask questions about the use of OCMock on Stackoverflow using the ocmock tag.