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


#import <Foundation/Foundation.h>

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

#import "SDLStartTime.h"
#import "SDLNames.h"

QuickSpecBegin(SDLStartTimeSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLStartTime* testStruct = [[SDLStartTime alloc] init];
        
        testStruct.hours = @22;
        testStruct.minutes = @39;
        testStruct.seconds = @11;
        
        expect(testStruct.hours).to(equal(@22));
        expect(testStruct.minutes).to(equal(@39));
        expect(testStruct.seconds).to(equal(@11));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{NAMES_hours:@22,
                                       NAMES_minutes:@39,
                                       NAMES_seconds:@11} mutableCopy];
        SDLStartTime* testStruct = [[SDLStartTime alloc] initWithDictionary:dict];
        
        expect(testStruct.hours).to(equal(@22));
        expect(testStruct.minutes).to(equal(@39));
        expect(testStruct.seconds).to(equal(@11));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLStartTime* testStruct = [[SDLStartTime alloc] init];
        
        expect(testStruct.hours).to(beNil());
        expect(testStruct.minutes).to(beNil());
        expect(testStruct.seconds).to(beNil());
    });
});

QuickSpecEnd