summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m
blob: 5a03830609f0990e2cbcb108ae7f8385de679b9d (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
//
//  SDLOnLockScreenStatusSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLOnLockScreenStatus.h"
#import "SDLHMILevel.h"
#import "SDLLockScreenStatus.h"
#import "SDLNames.h"

QuickSpecBegin(SDLOnLockScreenStatusSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] init];
        
        testNotification.driverDistractionStatus = @NO;
        testNotification.userSelected = @3;
        testNotification.lockScreenStatus = SDLLockScreenStatusRequired;
        testNotification.hmiLevel = SDLHMILevelNone;
        
        expect(testNotification.driverDistractionStatus).to(equal(@NO));
        expect(testNotification.userSelected).to(equal(@3));
        expect(testNotification.lockScreenStatus).to(equal(SDLLockScreenStatusRequired));
        expect(testNotification.hmiLevel).to(equal(SDLHMILevelNone));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{NAMES_notification:
                                           @{NAMES_parameters:
                                                 @{@"driverdistractionstatus":@NO,
                                                   @"userselected":@3,
                                                   @"OnLockScreenStatus":SDLLockScreenStatusRequired,
                                                   @"hmilevel":SDLHMILevelNone},
                                             NAMES_operation_name:@"OnLockScreenStatus"}} mutableCopy];
        SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] initWithDictionary:dict];
        
        expect(testNotification.driverDistractionStatus).to(equal(@NO));
        expect(testNotification.userSelected).to(equal(@3));
        expect(testNotification.lockScreenStatus).to(equal(SDLLockScreenStatusRequired));
        expect(testNotification.hmiLevel).to(equal(SDLHMILevelNone));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] init];
        
        expect(testNotification.driverDistractionStatus).to(beNil());
        expect(testNotification.userSelected).to(beNil());
        expect(testNotification.lockScreenStatus).to(beNil());
        expect(testNotification.hmiLevel).to(beNil());
    });
});

QuickSpecEnd