I have a ViewController with a Container View to display different child view controllers.
I would like to know if there is a way to test the Embed Segue using OCMockObject.
Below is the Test Case Setup:
@interface ViewControllerTests : XCTestCase {
ViewController *vc;
id vcMock;
}
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
vcMock = [OCMockObject partialMockForObject:vc];
[[vcMock expect] performSegueWithIdentifier:@"embedSegue" sender:nil];
[vc performSelectorOnMainThread:@selector(loadView) withObject:nil waitUntilDone:YES];
[vc viewDidLoad];
[vc viewWillAppear:YES];
[vc viewDidAppear:YES];
}
-(void) testEmbedSegue {
[vcMock verify];
}
Aucun commentaire:
Enregistrer un commentaire