summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatMemoryActionSpec.m
blob: aaeece688d49fc6e4e16d01746d5d621ab896daa (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
51
52
53
54
55
56
57
58
59
60
//
//  SDLSeatMemoryActionSpec.m
//  SmartDeviceLinkTests
//

#import <Foundation/Foundation.h>

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

#import "SDLRPCParameterNames.h"
#import "SDLSeatMemoryAction.h"

QuickSpecBegin(SDLSeatMemoryActionSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] init];

        testStruct.id = @12;
        testStruct.action = SDLSeatMemoryActionTypeSave;
        testStruct.label = @"Save";

        expect(testStruct.id).to(equal(@12));
        expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeSave));
        expect(testStruct.label).to(equal(@"Save"));

    });

    it(@"Should set and get correctly", ^ {
        SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] initWithId:23 label:@"restore" action:SDLSeatMemoryActionTypeRestore];

        expect(testStruct.id).to(equal(@23));
        expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeRestore));
        expect(testStruct.label).to(equal(@"restore"));

    });

    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLRPCParameterNameId:@54,
                                       SDLRPCParameterNameLabel:@"none",
                                       SDLRPCParameterNameAction: SDLSeatMemoryActionTypeNone
                                       } mutableCopy];
        SDLSeatMemoryAction *testStruct = [[SDLSeatMemoryAction alloc] initWithDictionary:dict];

        expect(testStruct.id).to(equal(@54));
        expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeNone));
        expect(testStruct.label).to(equal(@"none"));
    });

    it(@"Should return nil if not set", ^ {
        SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] init];

        expect(testStruct.id).to(beNil());
        expect(testStruct.action).to(beNil());
        expect(testStruct.label).to(beNil());
    });
});

QuickSpecEnd