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 Foundation | |
| import XCTest | |
| import RxTests | |
| import RxSwift | |
| class TestRxSwiftInterval : XCTestCase { | |
| func testRxSwiftInterval() { | |
| // Arrange | |
| let scheduler = TestScheduler(initialClock: 0) |
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 Foundation | |
| import XCTest | |
| import RxSwift | |
| import RxTests | |
| class RxSwiftRxTestPublish : XCTestCase { | |
| func testPublish() { | |
| // Arrange: |
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 Foundation | |
| import XCTest | |
| import RxSwift | |
| import RxTests | |
| class RxSwiftRxTestSkipUntil : XCTestCase { | |
| func testSkipUntil() { | |
| // Arrange: |
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 Foundation | |
| import RxSwift | |
| import RxTests | |
| import XCTest | |
| class TestCase: XCTestCase { | |
| func testAmb() { | |
| // Arrange: |
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 Foundation | |
| import RxSwift | |
| import RxTests | |
| import XCTest | |
| class TestCase: XCTestCase { | |
| func testReplaySubject() { | |
| // Arrange: |
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
| // 1. Create a protocol that detaches the only function (or requirement) we care about from the interface | |
| protocol URLSessionDataRequestTrait { | |
| func dataTaskWithRequest( | |
| request: NSURLRequest, | |
| completionHandler: (NSData?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask | |
| } | |
| // 2. NSURLSession already has this function so extension is easy | |
| extension NSURLSession: URLSessionDataRequestTrait {} |
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 Foundation | |
| import RxSwift | |
| import RxTests | |
| import XCTest | |
| class TestCase: XCTestCase { | |
| func testScheduledEvents() { | |
| let scheduler = TestScheduler(initialClock: 0) |
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
| // Test | |
| NSManagedObjectContext *context = [self managedObjectContext]; | |
| NSManagedObject *model = [NSEntityDescription | |
| insertNewObjectForEntityForName:@"Entity" | |
| inManagedObjectContext:context]; | |
| [model setValue:@"Any old value" forKey:@"attributeName"]; | |
| NSError *error; | |
| if (![context save:&error]) { | |
| NSLog(@"Couldn't save: %@", [error localizedDescription]); |
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
| - (void)saveContext | |
| { | |
| NSError *error = nil; | |
| NSManagedObjectContext *managedObjectContext = self.managedObjectContext; | |
| if (managedObjectContext != nil) | |
| { | |
| if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) | |
| { | |
| /* | |
| Replace this implementation with code to handle the error appropriately. |
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
| @synthesize managedObjectContext=__managedObjectContext; | |
| @synthesize managedObjectModel=__managedObjectModel; | |
| @synthesize persistentStoreCoordinator=__persistentStoreCoordinator; |
NewerOlder