Added code and fake objects to pass the test.

This commit is contained in:
NicholasTD07
2014-03-09 11:46:06 +08:00
parent b31ab92b8e
commit 949ec1e18d
6 changed files with 62 additions and 2 deletions

View File

@@ -6,7 +6,13 @@
// Copyright (c) 2014 Nicholas Tian. All rights reserved.
//
// Class Under Test
#import "NTDCoreDataTableViewController.h"
// Collaborators
#import "NTDFakeFetchedResultsController.h"
// Test Support
#import <XCTest/XCTest.h>
@interface NTDCoreDataTableViewControllerTests : XCTestCase
@@ -22,6 +28,7 @@
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
sut = [[NTDCoreDataTableViewController alloc] init];
}
- (void)tearDown
@@ -33,11 +40,11 @@
- (void)testIfFRCIsNotNilThenFRCsPerformFetchIsCalledWhenSutsPerformFetchIsCalled
{
// given
sut.fetchedResultsController = [[NSFetchedResultsController alloc] init];
sut.fetchedResultsController = [[NTDFakeFetchedResultsController alloc] init];
// when
[sut performFetch];
// then
XCTAssertTrue(sut.fetchedResultsController.performFetchIsCalled);
XCTAssertTrue([(NTDFakeFetchedResultsController *)(sut.fetchedResultsController) performFetchIsCalled]);
}
@end