88
99#import < XCTest/XCTest.h>
1010#import " CCPackage.h"
11+ #import " CCPackage_private.h"
1112#import " CCUnitTestAssertions.h"
13+ #import " CCPackage+InstallData.h"
1214
1315@interface CCPackageTests : XCTestCase
1416
@@ -53,6 +55,10 @@ - (void)testInitWithDictionary
5355 @" remoteURL" : @" http://foo.fake" ,
5456 @" installURL" : @" /Library/Caches/Packages" ,
5557 @" status" : @(CCPackageStatusInstalledDisabled),
58+ @" localDownloadURL" : @" /downloadfolder/baa.zip" ,
59+ @" localUnzipURL" : @" /unzupfolder/foo" ,
60+ @" folderName" : @" somename" ,
61+ @" enableOnDownload" : @(YES )
5662 };
5763
5864 CCPackage *package = [[CCPackage alloc ] initWithDictionary: dictionary];
@@ -63,6 +69,10 @@ - (void)testInitWithDictionary
6369 XCTAssertEqualObjects (package.remoteURL , [NSURL URLWithString: @" http://foo.fake" ]);
6470 XCTAssertEqualObjects (package.installURL , [NSURL fileURLWithPath: @" /Library/Caches/Packages" ]);
6571 XCTAssertEqual (package.status , CCPackageStatusInstalledDisabled);
72+ XCTAssertEqualObjects (package.localDownloadURL , [NSURL fileURLWithPath: @" /downloadfolder/baa.zip" ]);
73+ XCTAssertEqualObjects (package.unzipURL , [NSURL fileURLWithPath: @" /unzupfolder/foo" ]);
74+ CCAssertEqualStrings (package.folderName , @" somename" );
75+ XCTAssertTrue (package.enableOnDownload );
6676}
6777
6878- (void )testToDictionary
@@ -72,8 +82,12 @@ - (void)testToDictionary
7282 os: @" iOS"
7383 remoteURL: [NSURL URLWithString: @" http://foo.fake" ]];
7484
75- [package setValue: @(CCPackageStatusInstalledDisabled) forKey: @" status" ];
76- [package setValue: [NSURL fileURLWithPath: @" /Library/Caches/Packages" ] forKey: @" installURL" ];
85+ package.status = CCPackageStatusInstalledDisabled;
86+ package.installURL = [NSURL fileURLWithPath: @" /Library/Caches/Packages" ];
87+ package.unzipURL = [NSURL fileURLWithPath: @" /unzupfolder/foo" ];
88+ package.folderName = @" somename" ;
89+ package.localDownloadURL = [NSURL fileURLWithPath: @" /downloadfolder/baa.zip" ];
90+ package.enableOnDownload = NO ;
7791
7892 NSDictionary *dictionary = [package toDictionary ];
7993
@@ -83,6 +97,10 @@ - (void)testToDictionary
8397 CCAssertEqualStrings (dictionary[@" remoteURL" ], @" http://foo.fake" );
8498 CCAssertEqualStrings (dictionary[@" installURL" ], @" /Library/Caches/Packages" );
8599 XCTAssertEqual ([dictionary[@" status" ] integerValue ], CCPackageStatusInstalledDisabled);
100+ CCAssertEqualStrings (dictionary[@" localDownloadURL" ], @" /downloadfolder/baa.zip" );
101+ CCAssertEqualStrings (dictionary[@" localUnzipURL" ], @" /unzupfolder/foo" );
102+ CCAssertEqualStrings (dictionary[@" folderName" ], @" somename" );
103+ XCTAssertFalse ([dictionary[@" enableOnDownload" ] boolValue ]);
86104}
87105
88106@end
0 commit comments