summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnButtonPressSpec.m
blob: 4467f72a5d17156de25512877ee5ae04dbda69ea (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
//
//  SDLOnButtonPressSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLButtonName.h"
#import "SDLButtonPressMode.h"
#import "SDLOnButtonPress.h"
#import "SDLNames.h"


QuickSpecBegin(SDLOnButtonPressSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLOnButtonPress* testNotification = [[SDLOnButtonPress alloc] init];
        
        testNotification.buttonName = [SDLButtonName CUSTOM_BUTTON];
        testNotification.buttonPressMode = [SDLButtonPressMode LONG];
        testNotification.customButtonID = @5642;
        
        expect(testNotification.buttonName).to(equal([SDLButtonName CUSTOM_BUTTON]));
        expect(testNotification.buttonPressMode).to(equal([SDLButtonPressMode LONG]));
        expect(testNotification.customButtonID).to(equal(@5642));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{NAMES_notification:
                                           @{NAMES_parameters:
                                                 @{NAMES_buttonName:[SDLButtonName CUSTOM_BUTTON],
                                                   NAMES_buttonPressMode:[SDLButtonPressMode LONG],
                                                   NAMES_customButtonID:@5642},
                                             NAMES_operation_name:NAMES_OnButtonPress}} mutableCopy];
        SDLOnButtonPress* testNotification = [[SDLOnButtonPress alloc] initWithDictionary:dict];
        
        expect(testNotification.buttonName).to(equal([SDLButtonName CUSTOM_BUTTON]));
        expect(testNotification.buttonPressMode).to(equal([SDLButtonPressMode LONG]));
        expect(testNotification.customButtonID).to(equal(@5642));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLOnButtonPress* testNotification = [[SDLOnButtonPress alloc] init];
        
        expect(testNotification.buttonName).to(beNil());
        expect(testNotification.buttonPressMode).to(beNil());
        expect(testNotification.customButtonID).to(beNil());
    });
});

QuickSpecEnd