summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCreateInteractionChoiceSetSpec.m
blob: 52c496f8b5236227088ec6dd675fad19f55ff794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
//  SDLCreateInteractionChoiceSetSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

#import "SDLCreateInteractionChoiceSet.h"
#import "SDLChoice.h"
#import "SDLNames.h"

QuickSpecBegin(SDLCreateInteractionChoiceSetSpec)

SDLChoice* choice = [[SDLChoice alloc] init];

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLCreateInteractionChoiceSet* testRequest = [[SDLCreateInteractionChoiceSet alloc] init];
        
        testRequest.interactionChoiceSetID = @141414;
        testRequest.choiceSet = [@[choice] mutableCopy];
        
        expect(testRequest.interactionChoiceSetID).to(equal(@141414));
        expect(testRequest.choiceSet).to(equal([@[choice] mutableCopy]));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary<NSString *, id> *dict = [@{SDLNameRequest:
                                                           @{SDLNameParameters:
                                                                 @{SDLNameInteractionChoiceSetId:@141414,
                                                                   SDLNameChoiceSet:[@[choice] mutableCopy]},
                                                             SDLNameOperationName:SDLNameCreateInteractionChoiceSet}} mutableCopy];
        SDLCreateInteractionChoiceSet* testRequest = [[SDLCreateInteractionChoiceSet alloc] initWithDictionary:dict];

        expect(testRequest.interactionChoiceSetID).to(equal(@141414));
        expect(testRequest.choiceSet).to(equal([@[choice] mutableCopy]));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLCreateInteractionChoiceSet* testRequest = [[SDLCreateInteractionChoiceSet alloc] init];
        
        expect(testRequest.interactionChoiceSetID).to(beNil());
        expect(testRequest.choiceSet).to(beNil());
    });
});

QuickSpecEnd