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
103
104
105
106
107
108
109
110
111
112
113
114
|
//
// SDLRegisterAppInterfaceSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLAppHMIType.h"
#import "SDLAppInfo.h"
#import "SDLDeviceInfo.h"
#import "SDLLanguage.h"
#import "SDLNames.h"
#import "SDLRegisterAppInterface.h"
#import "SDLSyncMsgVersion.h"
#import "SDLTTSChunk.h"
QuickSpecBegin(SDLRegisterAppInterfaceSpec)
SDLSyncMsgVersion* version = [[SDLSyncMsgVersion alloc] init];
SDLTTSChunk* chunk = [[SDLTTSChunk alloc] init];
SDLDeviceInfo* info = [[SDLDeviceInfo alloc] init];
SDLAppInfo* appInfo = [[SDLAppInfo alloc] init];
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLRegisterAppInterface* testRequest = [[SDLRegisterAppInterface alloc] init];
testRequest.syncMsgVersion = version;
testRequest.appName = @"app56";
testRequest.ttsName = [@[chunk] mutableCopy];
testRequest.ngnMediaScreenAppName = @"whatisanngn";
testRequest.vrSynonyms = [@[@"paraphrase of the original name"] mutableCopy];
testRequest.isMediaApplication = @NO;
testRequest.languageDesired = [SDLLanguage NO_NO];
testRequest.hmiDisplayLanguageDesired = [SDLLanguage PT_PT];
testRequest.appHMIType = [@[[SDLAppHMIType MESSAGING], [SDLAppHMIType INFORMATION]] copy];
testRequest.hashID = @"gercd35grw2";
testRequest.deviceInfo = info;
testRequest.appID = @"123456789";
testRequest.appInfo = appInfo;
expect(testRequest.syncMsgVersion).to(equal(version));
expect(testRequest.appName).to(equal(@"app56"));
expect(testRequest.ttsName).to(equal([@[chunk] mutableCopy]));
expect(testRequest.ngnMediaScreenAppName).to(equal(@"whatisanngn"));
expect(testRequest.vrSynonyms).to(equal([@[@"paraphrase of the original name"] mutableCopy]));
expect(testRequest.isMediaApplication).to(equal(@NO));
expect(testRequest.languageDesired).to(equal([SDLLanguage NO_NO]));
expect(testRequest.hmiDisplayLanguageDesired).to(equal([SDLLanguage PT_PT]));
expect(testRequest.appHMIType).to(equal([@[[SDLAppHMIType MESSAGING], [SDLAppHMIType INFORMATION]] copy]));
expect(testRequest.hashID).to(equal(@"gercd35grw2"));
expect(testRequest.deviceInfo).to(equal(info));
expect(testRequest.appID).to(equal(@"123456789"));
expect(testRequest.appInfo).to(equal(appInfo));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameRequest:
@{SDLNameParameters:
@{SDLNameSyncMsgVersion:version,
SDLNameAppName:@"app56",
SDLNameTtsName:[@[chunk] mutableCopy],
SDLNameNgnMediaScreenAppName:@"whatisanngn",
SDLNameVrSynonyms:[@[@"paraphrase of the original name"] mutableCopy],
SDLNameIsMediaApplication:@NO,
SDLNameLanguageDesired:[SDLLanguage NO_NO],
SDLNameHmiDisplayLanguageDesired:[SDLLanguage PT_PT],
SDLNameAppHmiType:[@[[SDLAppHMIType MESSAGING], [SDLAppHMIType INFORMATION]] copy],
SDLNameHashId:@"gercd35grw2",
SDLNameDeviceInfo:info,
SDLNameAppId:@"123456789",
SDLNameAppInfo:appInfo},
SDLNameOperationName:SDLNameRegisterAppInterface}} mutableCopy];
SDLRegisterAppInterface* testRequest = [[SDLRegisterAppInterface alloc] initWithDictionary:dict];
expect(testRequest.syncMsgVersion).to(equal(version));
expect(testRequest.appName).to(equal(@"app56"));
expect(testRequest.ttsName).to(equal([@[chunk] mutableCopy]));
expect(testRequest.ngnMediaScreenAppName).to(equal(@"whatisanngn"));
expect(testRequest.vrSynonyms).to(equal([@[@"paraphrase of the original name"] mutableCopy]));
expect(testRequest.isMediaApplication).to(equal(@NO));
expect(testRequest.languageDesired).to(equal([SDLLanguage NO_NO]));
expect(testRequest.hmiDisplayLanguageDesired).to(equal([SDLLanguage PT_PT]));
expect(testRequest.appHMIType).to(equal([@[[SDLAppHMIType MESSAGING], [SDLAppHMIType INFORMATION]] copy]));
expect(testRequest.hashID).to(equal(@"gercd35grw2"));
expect(testRequest.deviceInfo).to(equal(info));
expect(testRequest.appID).to(equal(@"123456789"));
expect(testRequest.appInfo).to(equal(appInfo));
});
it(@"Should return nil if not set", ^ {
SDLRegisterAppInterface* testRequest = [[SDLRegisterAppInterface alloc] init];
expect(testRequest.syncMsgVersion).to(beNil());
expect(testRequest.appName).to(beNil());
expect(testRequest.ttsName).to(beNil());
expect(testRequest.ngnMediaScreenAppName).to(beNil());
expect(testRequest.vrSynonyms).to(beNil());
expect(testRequest.isMediaApplication).to(beNil());
expect(testRequest.languageDesired).to(beNil());
expect(testRequest.hmiDisplayLanguageDesired).to(beNil());
expect(testRequest.appHMIType).to(beNil());
expect(testRequest.hashID).to(beNil());
expect(testRequest.deviceInfo).to(beNil());
expect(testRequest.appID).to(beNil());
expect(testRequest.appInfo).to(beNil());
});
});
QuickSpecEnd
|