@@ -48,7 +48,7 @@ public override IEnumerable<object[]> GetData(MethodInfo testMethod)
4848 {
4949 var folderNames = new List < object [ ] >
5050 {
51- new object [ ] { CoreConstants . ContentFolderName , false , null , } ,
51+ new object [ ] { CoreConstants . ContentFolderName , false , CoreConstants . JsonContentType , } ,
5252 new object [ ] { CoreConstants . DownloadsFolderName , true , CoreConstants . OctetStreamContentType } ,
5353 new object [ ] { CoreConstants . PackageBackupsFolderName , true , CoreConstants . PackageContentType } ,
5454 new object [ ] { CoreConstants . PackageReadMesFolderName , false , CoreConstants . TextContentType } ,
@@ -73,7 +73,6 @@ public override IEnumerable<object[]> GetData(MethodInfo testMethod)
7373 else if ( ! IncludePermissions && IncludeContentTypes )
7474 {
7575 folderNames = folderNames
76- . Where ( fn => fn [ 2 ] != null )
7776 . Select ( fn => new [ ] { fn [ 0 ] , fn [ 2 ] } )
7877 . ToList ( ) ;
7978 }
@@ -512,6 +511,41 @@ public async Task WillSetTheBlobContentType(string folderName, string contentTyp
512511 Assert . Equal ( contentType , fakeBlob . Object . Properties . ContentType ) ;
513512 fakeBlob . Verify ( x => x . SetPropertiesAsync ( ) ) ;
514513 }
514+
515+ [ Theory ]
516+ [ FolderNamesData ]
517+ public async Task WillSetTheBlobControlCacheOnPackagesFolder ( string folderName )
518+ {
519+ var fakeBlobClient = new Mock < ICloudBlobClient > ( ) ;
520+ var fakeBlobContainer = new Mock < ICloudBlobContainer > ( ) ;
521+ fakeBlobContainer . Setup ( x => x . CreateIfNotExistAsync ( ) ) . Returns ( Task . FromResult ( 0 ) ) ;
522+ fakeBlobContainer . Setup ( x => x . SetPermissionsAsync ( It . IsAny < BlobContainerPermissions > ( ) ) ) . Returns ( Task . FromResult ( 0 ) ) ;
523+ var fakeBlob = new Mock < ISimpleCloudBlob > ( ) ;
524+ fakeBlobClient . Setup ( x => x . GetContainerReference ( It . IsAny < string > ( ) ) ) . Returns ( fakeBlobContainer . Object ) ;
525+ fakeBlobContainer . Setup ( x => x . GetBlobReference ( It . IsAny < string > ( ) ) ) . Returns ( fakeBlob . Object ) ;
526+ fakeBlob . Setup ( x => x . Properties ) . Returns ( new BlobProperties ( ) ) ;
527+ fakeBlob . Setup ( x => x . Uri ) . Returns ( new Uri ( "http://theUri" ) ) ;
528+ fakeBlob . Setup ( x => x . DeleteIfExistsAsync ( ) ) . Returns ( Task . FromResult ( 0 ) ) ;
529+ fakeBlob . Setup ( x => x . SetPropertiesAsync ( ) ) . Returns ( Task . FromResult ( 0 ) ) ;
530+ var service = CreateService ( fakeBlobClient : fakeBlobClient ) ;
531+ var fakePackageFile = new MemoryStream ( ) ;
532+ fakeBlob . Setup ( x => x . UploadFromStreamAsync ( fakePackageFile , true ) ) . Returns ( Task . FromResult ( 0 ) ) . Verifiable ( ) ;
533+
534+ await service . SaveFileAsync ( folderName , "theFileName" , fakePackageFile ) ;
535+
536+ fakeBlob . Verify ( ) ;
537+
538+ if ( folderName == CoreConstants . PackagesFolderName )
539+ {
540+ Assert . Equal ( CoreConstants . DefaultCacheControl , fakeBlob . Object . Properties . CacheControl ) ;
541+ }
542+ else
543+ {
544+ Assert . Null ( fakeBlob . Object . Properties . CacheControl ) ;
545+ }
546+
547+ fakeBlob . Verify ( x => x . SetPropertiesAsync ( ) ) ;
548+ }
515549 }
516550
517551 public class TheSaveFileWithAccessConditionMethod
0 commit comments