summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLListFilesResponseSpec.m
blob: 8934562eb0160d61e1086b1b41980510c415a86e (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
//
//  SDLListFilesResponseSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLListFilesResponse.h"
#import "SDLNames.h"

QuickSpecBegin(SDLListFilesResponseSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLListFilesResponse* testResponse = [[SDLListFilesResponse alloc] init];
        
        testResponse.filenames = [@[@"Music/music.mp3", @"Documents/document.txt", @"Downloads/format.exe"] mutableCopy];
        testResponse.spaceAvailable = @500000000;
        
        expect(testResponse.filenames).to(equal([@[@"Music/music.mp3", @"Documents/document.txt", @"Downloads/format.exe"] mutableCopy]));
        expect(testResponse.spaceAvailable).to(equal(@500000000));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLNameResponse:
                                           @{SDLNameParameters:
                                                 @{SDLNameFilenames:[@[@"Music/music.mp3", @"Documents/document.txt", @"Downloads/format.exe"] mutableCopy],
                                                   SDLNameSpaceAvailable:@500000000},
                                             SDLNameOperationName:SDLNameListFiles}} mutableCopy];
        SDLListFilesResponse* testResponse = [[SDLListFilesResponse alloc] initWithDictionary:dict];
        
        expect(testResponse.filenames).to(equal([@[@"Music/music.mp3", @"Documents/document.txt", @"Downloads/format.exe"] mutableCopy]));
        expect(testResponse.spaceAvailable).to(equal(@500000000));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLListFilesResponse* testResponse = [[SDLListFilesResponse alloc] init];
        
        expect(testResponse.filenames).to(beNil());
        expect(testResponse.spaceAvailable).to(beNil());
    });
});

QuickSpecEnd