diff options
Diffstat (limited to 'SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m')
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m | 157 |
1 files changed, 127 insertions, 30 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m index 351a6e558..bd806af6b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m @@ -8,7 +8,8 @@ #import <Quick/Quick.h> #import <Nimble/Nimble.h> -#import "SDLNames.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" #import "SDLSetMediaClockTimer.h" #import "SDLStartTime.h" #import "SDLUpdateMode.h" @@ -16,10 +17,132 @@ QuickSpecBegin(SDLSetMediaClockTimerSpec) -SDLStartTime* time1 = [[SDLStartTime alloc] init]; -SDLStartTime* time2 = [[SDLStartTime alloc] init]; +describe(@"SetMediaClocktimer Spec", ^ { + __block NSTimeInterval testTime1Interval = 32887; + __block NSTimeInterval testTime2Interval = 3723; + __block SDLStartTime *time1 = [[SDLStartTime alloc] initWithHours:9 minutes:8 seconds:7]; + __block SDLStartTime *time2 = [[SDLStartTime alloc] initWithHours:1 minutes:2 seconds:3]; + __block SDLUpdateMode testUpdateMode = SDLUpdateModeCountUp; + __block SDLAudioStreamingIndicator testIndicator = SDLAudioStreamingIndicatorPlayPause; + + describe(@"when initialized", ^{ + it(@"should properly initialize with initWithDictionary:", ^{ + NSMutableDictionary* dict = [@{SDLRPCParameterNameRequest: + @{SDLRPCParameterNameParameters: + @{SDLRPCParameterNameStartTime:time1, + SDLRPCParameterNameEndTime:time2, + SDLRPCParameterNameUpdateMode:testUpdateMode, + SDLRPCParameterNameAudioStreamingIndicator:testIndicator + }, + SDLRPCParameterNameOperationName:SDLRPCFunctionNameSetMediaClockTimer}} mutableCopy]; + SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] initWithDictionary:dict]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(testUpdateMode)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with init", ^{ + SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] init]; + + expect(testRequest.startTime).to(beNil()); + expect(testRequest.endTime).to(beNil()); + expect(testRequest.updateMode).to(beNil()); + expect(testRequest.audioStreamingIndicator).to(beNil()); + }); + + it(@"should properly initialize with countUpWithStartTimeInterval:endTimeInterval:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer countUpFromStartTimeInterval:testTime1Interval toEndTimeInterval:testTime2Interval playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with countUpWithStartTime:endTime:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer countUpFromStartTime:time1 toEndTime:time2 playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with countUpWithStartTimeInterval:endTimeInterval:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer countDownFromStartTimeInterval:testTime1Interval toEndTimeInterval:testTime2Interval playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModeCountDown)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with countDownWithStartTime:endTime:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer countDownFromStartTime:time1 toEndTime:time2 playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModeCountDown)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with pauseWithPlayPauseIndicator", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer pauseWithPlayPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(beNil()); + expect(testRequest.endTime).to(beNil()); + expect(testRequest.updateMode).to(equal(SDLUpdateModePause)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with updatePauseWithNewStartTimeInterval:endTimeInterval:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer updatePauseWithNewStartTimeInterval:testTime1Interval endTimeInterval:testTime2Interval playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModePause)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with updatePauseWithNewStartTime:endTime:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer updatePauseWithNewStartTime:time1 endTime:time2 playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(SDLUpdateModePause)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with resumeWithPlayPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer resumeWithPlayPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(beNil()); + expect(testRequest.endTime).to(beNil()); + expect(testRequest.updateMode).to(equal(SDLUpdateModeResume)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with clearWithPlayPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [SDLSetMediaClockTimer clearWithPlayPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(beNil()); + expect(testRequest.endTime).to(beNil()); + expect(testRequest.updateMode).to(equal(SDLUpdateModeClear)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + + it(@"should properly initialize with initWithUpdateMode:startTime:endTime:playPauseIndicator:", ^{ + SDLSetMediaClockTimer *testRequest = [[SDLSetMediaClockTimer alloc] initWithUpdateMode:testUpdateMode startTime:time1 endTime:time2 playPauseIndicator:testIndicator]; + + expect(testRequest.startTime).to(equal(time1)); + expect(testRequest.endTime).to(equal(time2)); + expect(testRequest.updateMode).to(equal(testUpdateMode)); + expect(testRequest.audioStreamingIndicator).to(equal(testIndicator)); + }); + }); -describe(@"Getter/Setter Tests", ^ { it(@"Should set and get correctly", ^ { SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] init]; @@ -33,32 +156,6 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); expect(testRequest.audioStreamingIndicator).to(equal(SDLAudioStreamingIndicatorPlayPause)); }); - - it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{SDLNameRequest: - @{SDLNameParameters: - @{SDLNameStartTime:time1, - SDLNameEndTime:time2, - SDLNameUpdateMode:SDLUpdateModeCountUp, - SDLNameAudioStreamingIndicator:SDLAudioStreamingIndicatorPlayPause - }, - SDLNameOperationName:SDLNameSetMediaClockTimer}} mutableCopy]; - SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] initWithDictionary:dict]; - - expect(testRequest.startTime).to(equal(time1)); - expect(testRequest.endTime).to(equal(time2)); - expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); - expect(testRequest.audioStreamingIndicator).to(equal(SDLAudioStreamingIndicatorPlayPause)); - }); - - it(@"Should return nil if not set", ^ { - SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] init]; - - expect(testRequest.startTime).to(beNil()); - expect(testRequest.endTime).to(beNil()); - expect(testRequest.updateMode).to(beNil()); - expect(testRequest.audioStreamingIndicator).to(beNil()); - }); }); QuickSpecEnd |