0
OCMock을 사용하여 실험하고 있지만 지금까지 간단한 실험이 실패했습니다. 나는 다음과 같은 테스트 케이스를 호출 할 때아주 간단한 기본 OCMock 스텁이 작동하지 않습니다.
@interface HTTPConnection : NSObject <NSURLConnectionDelegate>
@property (strong, nonatomic) NSURLConnection *connection;
-(int) makeConnection:(NSString*) url; // implementation returns 5
@end
, 결과 변수 (5) (15) 따라서 실제 객체 메소드 호출있어하지 포함되지 모의 한 :
- (void)testExample
{
id connection = [OCMockObject mockForClass:[HTTPConnection class]];
[[[connection stub] andReturn: [NSNumber numberWithInt: 15]] makeConnection:[OCMArg any]];
HTTPConnection* realConnection = [[HTTPConnection alloc] init];
int result = [realConnection makeConnection:@"http://www.anything.com"];
}
내가 조롱하려는이 실험 수업을 감안할 때