Created
January 23, 2016 21:46
-
-
Save quellish/da084e83a800221f3969 to your computer and use it in GitHub Desktop.
testDaysSinceSignificantDateCrossingDaylightSavingsChange
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) testDaysSinceSignificantDateCrossingDaylightSavingsChange { | |
SignificantEvent *testEvent = nil; | |
NSInteger expectedResult = 2; | |
NSInteger testResult = 0; | |
NSDate *preDaylightSavingsDate = nil; | |
NSDate *postDaylightSavingsDate= nil; | |
NSCalendar *calendar = [self testCalendar]; | |
preDaylightSavingsDate = [calendar dateWithEra:1 year:2015 month:3 day:7 hour:12 minute:0 second:0 nanosecond:0]; | |
postDaylightSavingsDate = [calendar dateByAddingUnit:NSCalendarUnitDay value:expectedResult toDate:preDaylightSavingsDate options:NSCalendarMatchNextTimePreservingSmallerUnits]; | |
testEvent = [[PreDaylightSavingsEvent alloc] initWithEventDate:preDaylightSavingsDate]; | |
[(PreDaylightSavingsEvent *)testEvent setCurrentDate:postDaylightSavingsDate]; | |
testResult = [testEvent numberOfDaysInThePast]; | |
XCTAssertEqual(testResult, expectedResult, @"Incorrect number of days when daylight savings time is in effect. Expected: %ld . Received: %ld .", expectedResult, testResult ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment