Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Commit

Permalink
fix: NYTPhotoViewerArrayDataSourceTests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesstout committed Dec 12, 2017
1 parent 337625a commit 196ad10
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@
@import UIKit;
@import XCTest;

#import <NYTPhotoViewer/NYTPhotosDataSource.h>
#import "NYTExamplePhoto.h"
#import "NYTPhotoViewerArrayDataSource.h"

@interface NYTPhotosDataSourceTests : XCTestCase
@interface NYTPhotoViewerArrayDataSourceTests : XCTestCase

@end

@implementation NYTPhotosDataSourceTests
@implementation NYTPhotoViewerArrayDataSourceTests

- (void)testInitializerAcceptsNil {
XCTAssertNoThrow([[NYTPhotosDataSource alloc] initWithPhotos:nil]);
XCTAssertNoThrow([[NYTPhotoViewerArrayDataSource alloc] initWithPhotos:nil]);
}

- (void)testOutOfBoundsDoesNotCrash {
NYTPhotosDataSource *dataSource = [[NYTPhotosDataSource alloc] initWithPhotos:nil];
NYTPhotoViewerArrayDataSource *dataSource = [[NYTPhotoViewerArrayDataSource alloc] initWithPhotos:nil];
XCTAssertNoThrow(dataSource[1]);
}

- (void)testOutOfBoundsReturnsNil {
NYTPhotosDataSource *dataSource = [[NYTPhotosDataSource alloc] initWithPhotos:nil];
NYTPhotoViewerArrayDataSource *dataSource = [[NYTPhotoViewerArrayDataSource alloc] initWithPhotos:nil];
XCTAssertNil(dataSource[1]);
}

- (void)testValidIndexReturnsPhoto {
NYTPhotosDataSource *dataSource = [[NYTPhotosDataSource alloc] initWithPhotos:[self newTestPhotos]];
NYTPhotoViewerArrayDataSource *dataSource = [[NYTPhotoViewerArrayDataSource alloc] initWithPhotos:[self newTestPhotos]];
XCTAssertNotNil(dataSource[1]);
}

- (void)testValidIndexReturnsCorrectPhoto {
NSArray *photos = [self newTestPhotos];
NYTPhotosDataSource *dataSource = [[NYTPhotosDataSource alloc] initWithPhotos:photos];
NYTPhotoViewerArrayDataSource *dataSource = [[NYTPhotoViewerArrayDataSource alloc] initWithPhotos:photos];
XCTAssertEqualObjects(photos.firstObject, dataSource[0]);
}

Expand Down

0 comments on commit 196ad10

Please sign in to comment.