Created
January 6, 2017 21:39
-
-
Save petermolnar-dev/37425916f0f55039670b0b38b26097d0 to your computer and use it in GitHub Desktop.
PMODownloaderTests.m - With delegate
This file contains 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 <XCTest/XCTest.h> | |
#import "PMODownloader.h" | |
#import "PMODownloadNotifications.h" | |
@interface PMODownloaderTests : XCTestCase | |
@property (strong, nonatomic) PMODownloader *downloader; | |
@end | |
@implementation PMODownloaderTests | |
- (void)setUp { | |
[super setUp]; | |
self.downloader = [[PMODownloader alloc] init]; | |
} | |
- (void)tearDown { | |
self.downloader = nil; | |
[super tearDown]; | |
} | |
/** | |
Testing the download failure wiht a nonexisting domain | |
*/ | |
- (void)testPictureAsyncDownloadFailed { | |
XCTestExpectation *expectation = [self expectationForNotification:PMODownloadFailed | |
object: nil | |
handler:^BOOL(NSNotification * _Nonnull notification) { | |
[expectation fulfill]; | |
return true; | |
}]; | |
[self.downloader downloadDataFromURL:[NSURL URLWithString:@"https://ThereIsNoSuCHDomainName/MssedUPName.png"]]; | |
[self waitForExpectationsWithTimeout:5.0 handler:^(NSError *error) { | |
if (error) { | |
NSLog(@"Timeout Error: %@", error); | |
} | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment