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
|
//
// SDLSliderSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLSlider.h"
#import "SDLNames.h"
QuickSpecBegin(SDLSliderSpec)
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLSlider* testRequest = [[SDLSlider alloc] init];
testRequest.numTicks = @2;
testRequest.position = @1;
testRequest.sliderHeader = @"Head";
testRequest.sliderFooter = [@[@"LeftFoot", @"RightFoot"] mutableCopy];
testRequest.timeout = @2000;
expect(testRequest.numTicks).to(equal(@2));
expect(testRequest.position).to(equal(@1));
expect(testRequest.sliderHeader).to(equal(@"Head"));
expect(testRequest.sliderFooter).to(equal([@[@"LeftFoot", @"RightFoot"] mutableCopy]));
expect(testRequest.timeout).to(equal(@2000));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameRequest:
@{SDLNameParameters:
@{SDLNameNumberTicks:@2,
SDLNamePosition:@1,
SDLNameSliderHeader:@"Head",
SDLNameSliderFooter:[@[@"LeftFoot", @"RightFoot"] mutableCopy],
SDLNameTimeout:@2000},
SDLNameOperationName:SDLNameSlider}} mutableCopy];
SDLSlider* testRequest = [[SDLSlider alloc] initWithDictionary:dict];
expect(testRequest.numTicks).to(equal(@2));
expect(testRequest.position).to(equal(@1));
expect(testRequest.sliderHeader).to(equal(@"Head"));
expect(testRequest.sliderFooter).to(equal([@[@"LeftFoot", @"RightFoot"] mutableCopy]));
expect(testRequest.timeout).to(equal(@2000));
});
it(@"Should return nil if not set", ^ {
SDLSlider* testRequest = [[SDLSlider alloc] init];
expect(testRequest.numTicks).to(beNil());
expect(testRequest.position).to(beNil());
expect(testRequest.sliderHeader).to(beNil());
expect(testRequest.sliderFooter).to(beNil());
expect(testRequest.timeout).to(beNil());
});
});
QuickSpecEnd
|