Created
April 20, 2015 12:00
-
-
Save jellybeansoup/2f074944aab8259225c3 to your computer and use it in GitHub Desktop.
Unit Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import <XCTest/XCTest.h> | |
#import "StaticTables.h" | |
@interface StaticTablesDataSourceTests : XCTestCase | |
@end | |
@implementation StaticTablesDataSourceTests | |
- (void)setUp { | |
[super setUp]; | |
} | |
- (void)tearDown { | |
[super tearDown]; | |
} | |
- (void)testNewDataSource { | |
JSMStaticDataSource *dataSource = [JSMStaticDataSource new]; | |
XCTAssert( dataSource != nil, @"Datasource was not created." ); | |
} | |
- (void)testNewSection { | |
JSMStaticSection *section = [JSMStaticSection section]; | |
XCTAssert( section != nil, @"Section was not created." ); | |
} | |
- (void)testNewSectionWithKey { | |
NSString *key = @"example"; | |
JSMStaticSection *sectionWithKey = [JSMStaticSection sectionWithKey:key]; | |
XCTAssert( sectionWithKey != nil, @"Section was not created with key." ); | |
XCTAssert( [sectionWithKey.key isEqual:key], @"Section was not given key correctly." ); | |
} | |
- (void)testNewRow { | |
JSMStaticRow *row = [JSMStaticRow row]; | |
XCTAssert( row != nil, @"Row was not created." ); | |
} | |
- (void)testNewRowWithKey { | |
NSString *key = @"example"; | |
JSMStaticRow *rowWithKey = [JSMStaticRow rowWithKey:key]; | |
XCTAssert( rowWithKey != nil, @"Row was not created with key." ); | |
XCTAssert( [rowWithKey.key isEqual:key], @"Row was not given key correctly." ); | |
} | |
- (void)testCreateSection { | |
JSMStaticDataSource *dataSource = [JSMStaticDataSource new]; | |
JSMStaticSection *section = [dataSource createSection]; | |
XCTAssert( section != nil, @"Section was not created." ); | |
XCTAssert( [section.dataSource isEqual:dataSource], @"Section was not added to datasource." ); | |
XCTAssert( [dataSource.sections containsObject:section], @"Section is not available in datasource sections array." ); | |
} | |
- (void)testCreateRow { | |
JSMStaticSection *section = [JSMStaticSection section]; | |
JSMStaticRow *row = [section createRow]; | |
XCTAssert( row != nil, @"Row was not created." ); | |
XCTAssert( [row.section isEqual:section], @"Row was not added to section." ); | |
XCTAssert( [section.rows containsObject:row], @"Row is not available in section rows array." ); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment