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


#import <Foundation/Foundation.h>

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

#import "SDLAudioStreamingState.h"
#import "SDLHMILevel.h"
#import "SDLOnHMIStatus.h"
#import "SDLNames.h"
#import "SDLSystemContext.h"


QuickSpecBegin(SDLOnHMIStatusSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLOnHMIStatus* testNotification = [[SDLOnHMIStatus alloc] init];
        
        testNotification.hmiLevel = SDLHMILevelLimited;
        testNotification.audioStreamingState = SDLAudioStreamingStateAttenuated;
        testNotification.systemContext = SDLSystemContextHMIObscured;
        
        expect(testNotification.hmiLevel).to(equal(SDLHMILevelLimited));
        expect(testNotification.audioStreamingState).to(equal(SDLAudioStreamingStateAttenuated));
        expect(testNotification.systemContext).to(equal(SDLSystemContextHMIObscured));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLNameNotification:
                                           @{SDLNameParameters:
                                                 @{SDLNameHMILevel:SDLHMILevelLimited,
                                                   SDLNameAudioStreamingState:SDLAudioStreamingStateAttenuated,
                                                   SDLNameSystemContext:SDLSystemContextHMIObscured},
                                             SDLNameOperationName:SDLNameOnHMIStatus}} mutableCopy];
        SDLOnHMIStatus* testNotification = [[SDLOnHMIStatus alloc] initWithDictionary:dict];
        
        expect(testNotification.hmiLevel).to(equal(SDLHMILevelLimited));
        expect(testNotification.audioStreamingState).to(equal(SDLAudioStreamingStateAttenuated));
        expect(testNotification.systemContext).to(equal(SDLSystemContextHMIObscured));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLOnHMIStatus* testNotification = [[SDLOnHMIStatus alloc] init];
        
        expect(testNotification.hmiLevel).to(beNil());
        expect(testNotification.audioStreamingState).to(beNil());
        expect(testNotification.systemContext).to(beNil());
    });
});

QuickSpecEnd