diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-03-16 09:37:21 -0700 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-03-16 09:37:21 -0700 |
commit | 00ecf79981903768791f40001c7025c485fe038c (patch) | |
tree | 542275b686d5bfe9ee3e12cad96776ed4ab53d80 | |
parent | db5ca2372ac1decb52c6f0b7c56a04c4504eecac (diff) | |
download | sdl_ios-00ecf79981903768791f40001c7025c485fe038c.tar.gz |
Added Spec Test for handling heartbeat acknowledgement.
-rw-r--r-- | SmartDeviceLink-iOS/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m index 7c6f8dfaa..81046ebfd 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m +++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m @@ -381,6 +381,31 @@ describe(@"HandleProtocolSessionStarted Tests", ^ { }); }); +describe(@"HandleHeartbeatForSession Tests", ^{ + // TODO: Test automatically sending data to head unit (dependency injection?) + it(@"Should pass information along to delegate", ^ { + SDLProtocol* testProtocol = [[SDLProtocol alloc] init]; + + id delegateMock = OCMProtocolMock(@protocol(SDLProtocolListener)); + + __block BOOL verified = NO; + [[[[delegateMock stub] andDo:^(NSInvocation* invocation) { + verified = YES; + Byte sessionID; + + [invocation getArgument:&sessionID atIndex:2]; + + expect(@(sessionID)).to(equal(@0x44)); + }] ignoringNonObjectArgs] handleHeartbeatForSession:0]; + + [testProtocol.protocolDelegateTable addObject:delegateMock]; + + [testProtocol handleHeartbeatForSession:0x44]; + + expect(@(verified)).to(beTruthy()); + }); +}); + describe(@"OnProtocolMessageReceived Tests", ^ { it(@"Should pass information along to delegate", ^ { SDLProtocol* testProtocol = [[SDLProtocol alloc] init]; |