@@ -38,7 +38,10 @@ public IntegrationTest()
3838 clientFactory . GetDefaultContainerName ( ) . Returns ( DefaultContainerName ) ;
3939 clientFactory . GetClient ( ) . Returns ( new BlobServiceClient ( ConnectionString ) ) ;
4040 var options = Substitute . For < IOptions < AzureBlobStorageOptions > > ( ) ;
41- var streamManagerService = Substitute . For < IStreamManagerService > ( ) ;
41+
42+ var streamManagerOptions = new StreamManagerOptions ( ) ;
43+ var iOptionsStreamManager = Microsoft . Extensions . Options . Options . Create ( streamManagerOptions ) ;
44+ var streamManagerService = new StreamManagerService ( iOptionsStreamManager ) ;
4245
4346 _service = new AzureBlobStorageService < IAzureBlobStorageClientFactory > ( clientFactory , streamManagerService , options ) ;
4447
@@ -129,6 +132,54 @@ public async Task TestEntireProcess(string containerName)
129132
130133 filesAfterDeletion . Count . Should ( ) . Be ( 0 ) ;
131134
135+ // Delete folder and verify only folder with prefix is gone, others kept
136+ testFileReadStream . Seek ( 0 , SeekOrigin . Begin ) ;
137+ await _service . UploadBlobAsync ( testFileName , testFileContentType , testFileReadStream , containerName , "1" ) ;
138+ testFileReadStream . Seek ( 0 , SeekOrigin . Begin ) ;
139+ await _service . UploadBlobAsync ( testFileName , testFileContentType , testFileReadStream , containerName , "10" ) ;
140+ testFileReadStream . Seek ( 0 , SeekOrigin . Begin ) ;
141+ await _service . UploadBlobAsync ( testFileName , testFileContentType , testFileReadStream , containerName , "11" ) ;
142+ await _service . DeleteFolderAsync ( "1" , containerName ) ;
143+
144+ var filesAfterFolderDeletion = await _service . ListBlobsInContainerAsync ( containerName ) . ToListAsync ( ) ;
145+
146+ filesAfterFolderDeletion . Should ( ) . ContainEquivalentOf (
147+ new BlobInfoContract
148+ {
149+ Name = "10/" + testFileName ,
150+ AccessTier = "Hot" ,
151+ BlobType = "Block" ,
152+ ContentEncoding = string . Empty ,
153+ ContentType = testFileContentType ,
154+ DateCreated = DateTimeOffset . UtcNow ,
155+ Size = 1021702 ,
156+ } ,
157+ _comparisonOptions )
158+ . And . ContainEquivalentOf (
159+ new BlobInfoContract
160+ {
161+ Name = "11/" + testFileName ,
162+ AccessTier = "Hot" ,
163+ BlobType = "Block" ,
164+ ContentEncoding = string . Empty ,
165+ ContentType = testFileContentType ,
166+ DateCreated = DateTimeOffset . UtcNow ,
167+ Size = 1021702 ,
168+ } ,
169+ _comparisonOptions )
170+ . And . NotContainEquivalentOf (
171+ new BlobInfoContract
172+ {
173+ Name = "1/" + testFileName ,
174+ AccessTier = "Hot" ,
175+ BlobType = "Block" ,
176+ ContentEncoding = string . Empty ,
177+ ContentType = testFileContentType ,
178+ DateCreated = DateTimeOffset . UtcNow ,
179+ Size = 1021702 ,
180+ } ,
181+ _comparisonOptions ) ;
182+
132183 // Delete container and verify it's gone
133184 await _service . DeleteContainerAsync ( containerName ) ;
134185 var containersAfterDeletion = await _service . GetContainersAsync ( ) . ToListAsync ( ) ;
0 commit comments