summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetAppServiceDataResponseSpec.m
blob: 5f722514a1004813a822387a6750062a05a5b219 (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
55
56
57
58
59
//
//  SDLGetAppServiceDataResponseSpec.m
//  SmartDeviceLinkTests
//
//  Created by Nicole on 2/6/19.
//  Copyright © 2019 smartdevicelink. All rights reserved.
//

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

#import "SDLAppServiceData.h"
#import "SDLAppServiceType.h"
#import "SDLGetAppServiceDataResponse.h"
#import "SDLNames.h"

QuickSpecBegin(SDLGetAppServiceDataResponseSpec)

describe(@"Getter/Setter Tests", ^{
    __block SDLAppServiceData *testAppServiceData = nil;

    beforeEach(^{
        testAppServiceData = [[SDLAppServiceData alloc] init];
        testAppServiceData.serviceType = SDLAppServiceTypeMedia;
    });

    it(@"Should set and get correctly", ^{
        SDLGetAppServiceDataResponse *testResponse = [[SDLGetAppServiceDataResponse alloc] init];
        testResponse.serviceData = testAppServiceData;

        expect(testResponse.serviceData).to(equal(testAppServiceData));
    });

    it(@"Should get correctly when initialized with a dictionary", ^{
        NSDictionary *dict = @{SDLNameResponse:@{
                                       SDLNameParameters:@{
                                               SDLNameServiceData:testAppServiceData
                                               },
                                       SDLNameOperationName:SDLNameGetAppServiceData}};
        SDLGetAppServiceDataResponse *testResponse = [[SDLGetAppServiceDataResponse alloc] initWithDictionary:dict];

        expect(testResponse.serviceData).to(equal(testAppServiceData));
    });

    it(@"Should get correctly when initialized with initWithAppServiceData:", ^{
        SDLGetAppServiceDataResponse *testResponse = [[SDLGetAppServiceDataResponse alloc] initWithAppServiceData:testAppServiceData];

        expect(testResponse.serviceData).to(equal(testAppServiceData));
    });

    it(@"Should return nil if not set", ^{
        SDLGetAppServiceDataResponse *testResponse = [[SDLGetAppServiceDataResponse alloc] init];

        expect(testResponse.serviceData).to(beNil())
        ;
    });
});

QuickSpecEnd