-
Notifications
You must be signed in to change notification settings - Fork 110
/
SDLHMICapabilitiesSpec.m
102 lines (81 loc) 路 3.43 KB
/
SDLHMICapabilitiesSpec.m
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// SDLHMICapabilitiesSpec.m
// SmartDeviceLink-iOS
//
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLHMICapabilities.h"
#import "SDLRPCParameterNames.h"
QuickSpecBegin(SDLHMICapabilitiesSpec)
describe(@"SDLHMICapabilities struct", ^{
__block SDLHMICapabilities *testStruct = nil;
__block NSNumber *somePhoneCallState = @NO;
__block NSNumber *someNavigationState = @YES;
__block NSNumber *someVideoStreamState = @NO;
__block NSNumber *someRemoteControlState = @YES;
context(@"When initialized with properties", ^{
beforeEach(^{
testStruct = [[SDLHMICapabilities alloc] init];
testStruct.phoneCall = somePhoneCallState;
testStruct.navigation = someNavigationState;
testStruct.videoStreaming = someVideoStreamState;
testStruct.remoteControl = someRemoteControlState;
});
it(@"should properly set phone call", ^{
expect(testStruct.phoneCall).to(equal(somePhoneCallState));
});
it(@"should properly set navigation", ^{
expect(testStruct.navigation).to(equal(someNavigationState));
});
it(@"should properly set video streaming", ^{
expect(testStruct.videoStreaming).to(equal(someVideoStreamState));
});
it(@"should properly set remote control", ^{
expect(testStruct.remoteControl).to(equal(someRemoteControlState));
});
});
context(@"When initialized with a dictionary", ^{
beforeEach(^{
NSDictionary<NSString *, NSNumber *> *structInitDict = @{
SDLRPCParameterNameNavigation: someNavigationState,
SDLRPCParameterNamePhoneCall: somePhoneCallState,
SDLRPCParameterNameVideoStreaming: someVideoStreamState,
SDLRPCParameterNameRemoteControl: someRemoteControlState
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
testStruct = [[SDLHMICapabilities alloc] initWithDictionary:[structInitDict mutableCopy]];
#pragma clang diagnostic pop
});
it(@"should properly set phone call", ^{
expect(testStruct.phoneCall).to(equal(somePhoneCallState));
});
it(@"should properly set navigation", ^{
expect(testStruct.navigation).to(equal(someNavigationState));
});
it(@"should properly set video streaming", ^{
expect(testStruct.videoStreaming).to(equal(someVideoStreamState));
});
it(@"should properly set remote control", ^{
expect(testStruct.remoteControl).to(equal(someRemoteControlState));
});
});
context(@"When not initialized", ^{
beforeEach(^{
testStruct = nil;
});
it(@"phoneCall should be nil", ^{
expect(testStruct.phoneCall).to(beNil());
});
it(@"navigation should be nil", ^{
expect(testStruct.navigation).to(beNil());
});
it(@"video streaming should be nil", ^{
expect(testStruct.videoStreaming).to(beNil());
});
it(@"remote control should be nil", ^{
expect(testStruct.remoteControl).to(beNil());
});
});
});
QuickSpecEnd