???????????????? view ??????????????б??????
????UIView *view = photosViewController.view; STAssertNotNil(view?? @""); NSIndexPath* indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [photosViewController tableView:photosViewController.tableView         didSelectRowAtIndexPath:indexPath];
????????????? mocks ????????????????ù???
????[mockNavController verify]; [photosViewControllerMock verify];
????????????????????????????????? navigation controller ????????????? view controller ???????
????????ε??????????????????????????????
????- (id)autoVerifiedMockForClass:(Class)aClass; - (id)autoVerifiedPartialMockForObject:(id)object;
???????????????????????? -verify??
????????????
????????????濴??????????partial mocking ????????????? -[PhotosViewController setupTableView] ????????????????????δ? app delegate ????? model ??????
????NSArray *photos = [AppDelegate sharedDelegate].store.sortedPhotos;
?????????????????????д?????????????????????????????? partial mocking???? app delegate ???????????????????????
????id storeMock; // assume we've set this up id appDelegate = [AppDelegate sharedDelegate] id appDelegateMock = [OCMockObject partialMockForObject:appDelegate]; [[[appDelegateMock stub] andReturn:storeMock] store];
????????????? [AppDelegate sharedDelegate].store ?????ù?????????? storeMock?????????????????????????????????????????????и?????????
?????μ????
????Partial mocks ????? mocking ??????????? mocks ????????????Ч????????????????? [aMock stopMocking] ?????????????????????????? partial mock ???????????????????Ч?????????????????? [aMock verify]?????? ARC ????? dealloc ??? mock???????????????????????? -verify??
???????? NIB ????
????PhotoCell ????????? NIB ?У????????д??????????????? outlets ????????????????????????? PhotoCell ??
????@interface PhotoCell : UITableViewCell  + (UINib *)nib;  @property (weak?? nonatomic) IBOutlet UILabel* photoTitleLabel; @property (weak?? nonatomic) IBOutlet UILabel* photoDateLabel;  @end
??????????????????????????????
????@implementation PhotoCellTests  - (void)testNibLoading; {     UINib *nib = [PhotoCell nib];     STAssertNotNil(nib?? @"");      NSArray *a = [nib instantiateWithOwner:nil options:@{}];     STAssertEquals([a count]?? (NSUInteger) 1?? @"");     PhotoCell *cell = a[0];     STAssertTrue([cell isMemberOfClass:[PhotoCell class]]?? @"");      // Check that outlets are set up correctly:     STAssertNotNil(cell.photoTitleLabel?? @"");     STAssertNotNil(cell.photoDateLabel?? @""); }  @end
??????????????????????????
?????????????????????????????????????????? nib ?????????????????????????????? outlets ?仯????????????????????? .xib ?????????????????????????????????
???????? Class ?? Injection
??????????????? Xcode ???????????? bundle ???????ó????С??????????ι????????????????????????????????????????????? bundle?????????? bundle???е? Objective-C ?????????е???ó????С????????????????????????в??????
????????????????????????????????????????????????ó??????? bundle?С???????????????????У????????? PhotoCell ?????????? bundle ????ó??????????? bundle ?е??? [PhotoCell class] ???????????????????ó????е???????????????????????????
????STAssertTrue([cell isMemberOfClass:[PhotoCell class]]?? @"");
??????????????????????????????????????ó????е? .m ??????????? target ?С??????????????????????
????????????
????????????????????????????????????????????????????????????????????????????????Χ????Щ?????? RunUnitTests ????????????и? TEST_AFTER_BUILD ??????????
????????????????????????????? bundle ?????????????????????????????????κ??????????????????Щ????????? STAssert ????????????????????????????????