summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m
blob: a4f3efa0d6547a3ef89f427720c26973d49936a8 (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
//
//  SDLVehicleTypeSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLVehicleType.h"
#import "SDLRPCParameterNames.h"

QuickSpecBegin(SDLVehicleTypeSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLVehicleType* testStruct = [[SDLVehicleType alloc] init];
        
        testStruct.make = @"Make";
        testStruct.model = @"Model";
        testStruct.modelYear = @"3.141*10^36";
        testStruct.trim = @"AE";
        
        expect(testStruct.make).to(equal(@"Make"));
        expect(testStruct.model).to(equal(@"Model"));
        expect(testStruct.modelYear).to(equal(@"3.141*10^36"));
        expect(testStruct.trim).to(equal(@"AE"));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary<NSString *, id> *dict = [@{SDLRPCParameterNameMake:@"Make",
                                                       SDLRPCParameterNameModel:@"Model",
                                                       SDLRPCParameterNameModelYear:@"3.141*10^36",
                                                       SDLRPCParameterNameTrim:@"AE"} mutableCopy];
        SDLVehicleType* testStruct = [[SDLVehicleType alloc] initWithDictionary:dict];
        
        expect(testStruct.make).to(equal(@"Make"));
        expect(testStruct.model).to(equal(@"Model"));
        expect(testStruct.modelYear).to(equal(@"3.141*10^36"));
        expect(testStruct.trim).to(equal(@"AE"));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLVehicleType* testStruct = [[SDLVehicleType alloc] init];
        
        expect(testStruct.make).to(beNil());
        expect(testStruct.model).to(beNil());
        expect(testStruct.modelYear).to(beNil());
        expect(testStruct.trim).to(beNil());
    });
});

QuickSpecEnd