Skip to content

Commit

Permalink
Fixed issue with incorrectly parsing SDLRPCResponses.
Browse files Browse the repository at this point in the history
  • Loading branch information
asm09fsu committed Jan 20, 2017
1 parent b7b20f4 commit 36dc4c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 6 additions & 6 deletions SmartDeviceLink/SDLRPCResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ - (void)setCorrelationID:(NSNumber<SDLInt> *)corrID {
}

- (void)setSuccess:(NSNumber<SDLBool> *)success {
[store sdl_setObject:success forName:SDLNameSuccess];
[parameters sdl_setObject:success forName:SDLNameSuccess];
}

- (NSNumber<SDLBool> *)success {
return [store sdl_objectForName:SDLNameSuccess];
return [parameters sdl_objectForName:SDLNameSuccess];
}

- (void)setResultCode:(SDLResult)resultCode {
[store sdl_setObject:resultCode forName:SDLNameResultCode];
[parameters sdl_setObject:resultCode forName:SDLNameResultCode];
}

- (SDLResult)resultCode {
return [store sdl_objectForName:SDLNameResultCode];
return [parameters sdl_objectForName:SDLNameResultCode];
}

- (void)setInfo:(nullable NSString *)info {
[store sdl_setObject:info forName:SDLNameInfo];
[parameters sdl_setObject:info forName:SDLNameInfo];
}

- (nullable NSString *)info {
return [store sdl_objectForName:SDLNameInfo];
return [parameters sdl_objectForName:SDLNameInfo];
}

@end
Expand Down
19 changes: 19 additions & 0 deletions SmartDeviceLinkTests/RPCSpecs/SuperclassSpecs/SDLRPCResponseSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

#import "SDLNames.h"
#import "SDLResult.h"
#import "SDLRPCResponse.h"

Expand All @@ -28,6 +29,24 @@
expect(response.resultCode).to(equal(SDLResultIgnored));
expect(response.info).to(equal(@"It has been done"));
});

it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameResponse:
@{SDLNameParameters:
@{SDLNameSuccess:@YES,
SDLNameResultCode:SDLNameSuccess,
SDLNameInfo:@"Test Info"},
SDLNameCorrelationId:@1004,
SDLNameOperationName:SDLNameResponse}} mutableCopy];
SDLRPCResponse* testResponse = [[SDLRPCResponse alloc] initWithDictionary:dict];

expect(testResponse.getFunctionName).to(equal(SDLNameResponse));
expect(testResponse.correlationID).to(equal(@1004));
expect(testResponse.success).to(equal(@YES));
expect(testResponse.resultCode).to(equal(SDLNameSuccess));
expect(testResponse.info).to(equal(@"Test Info"));

});
});

QuickSpecEnd

0 comments on commit 36dc4c2

Please sign in to comment.