@@ -54,6 +54,17 @@ public async void DeleteByTags_WhenTagsAreValid_DoesNotThrow()
5454 { "tag2" , "value2" }
5555 } ;
5656 var containerName = "test-container" ;
57+
58+ var page = Page < TaggedBlobItem > . FromValues ( new List < TaggedBlobItem >
59+ {
60+ BlobsModelFactory . TaggedBlobItem ( "test-blob" , "test-container" , new Dictionary < string , string > { { "tag1" , "value1" } } ) ,
61+ BlobsModelFactory . TaggedBlobItem ( "test-blob" , "test-container" , new Dictionary < string , string > { { "tag2" , "value2" } } )
62+ } , continuationToken : null , Substitute . For < Response > ( ) ) ;
63+
64+ var pages = AsyncPageable < TaggedBlobItem > . FromPages ( new [ ] { page } ) ;
65+
66+ _blobContainerClient . FindBlobsByTagsAsync ( Arg . Any < string > ( ) ) . Returns ( pages ) ;
67+
5768 // Act & Assert
5869 var exception = await Record . ExceptionAsync ( ( ) => _sut . DeleteByTags ( tags , containerName ) ) ;
5970 Assert . Null ( exception ) ;
@@ -64,6 +75,17 @@ public async void GetAllBlobs_WhenContainerNameIsValid_ReturnsListOfLiquidBlob()
6475 {
6576 // Arrange
6677 var containerName = "test-container" ;
78+ var blobItem = BlobsModelFactory . BlobItem ( ) ;
79+
80+ _blobContainerClient . GetBlobsAsync ( ) . Returns ( AsyncPageable < BlobItem > . FromPages ( new [ ] { Page < BlobItem > . FromValues ( new [ ] { blobItem } , null , Substitute . For < Response > ( ) ) } ) ) ;
81+ _blockBlobClient . DownloadContentAsync ( ) . Returns ( Response . FromValue (
82+ BlobsModelFactory . BlobDownloadResult ( new BinaryData ( "test-blob" ) ) , null
83+ ) ) ;
84+ _blockBlobClient . GetTagsAsync ( ) . Returns ( Response . FromValue (
85+ BlobsModelFactory . GetBlobTagResult ( new Dictionary < string , string > { { "tag1" , "value1" } } ) , null
86+ ) ) ;
87+ _blockBlobClient . Uri . Returns ( new Uri ( "https://test.blob.core.windows.net/test-blob" ) ) ;
88+
6789 // Act
6890 var result = await _sut . GetAllBlobs ( containerName ) ;
6991 // Assert
@@ -192,7 +214,9 @@ public async void Delete_WhenBlobNameIsValid_DoesNotThrow()
192214 var blobName = "test-blob" ;
193215 var containerName = "test-container" ;
194216
195- _blobContainerClient . GetBlobClient ( Arg . Any < string > ( ) ) . Returns ( Substitute . For < BlobClient > ( ) ) ;
217+ var blobClient = Substitute . For < BlobClient > ( ) ;
218+ _blobContainerClient . GetBlobClient ( Arg . Any < string > ( ) ) . Returns ( blobClient ) ;
219+
196220 // Act & Assert
197221 var exception = await Record . ExceptionAsync ( ( ) => _sut . Delete ( blobName , containerName ) ) ;
198222
@@ -209,6 +233,26 @@ public async void ReadBlobsByTags_WhenTagsAreValid_ReturnsListOfLiquidBlob()
209233 { "tag2" , "value2" }
210234 } ;
211235 var containerName = "test-container" ;
236+
237+ var page = Page < TaggedBlobItem > . FromValues ( new List < TaggedBlobItem >
238+ {
239+ BlobsModelFactory . TaggedBlobItem ( "test-blob" , "test-container" , new Dictionary < string , string > { { "tag1" , "value1" } } ) ,
240+ BlobsModelFactory . TaggedBlobItem ( "test-blob" , "test-container" , new Dictionary < string , string > { { "tag2" , "value2" } } )
241+ } , continuationToken : null , Substitute . For < Response > ( ) ) ;
242+
243+ var pages = AsyncPageable < TaggedBlobItem > . FromPages ( new [ ] { page } ) ;
244+
245+ _blobContainerClient . FindBlobsByTagsAsync ( Arg . Any < string > ( ) ) . Returns ( pages ) ;
246+
247+ _blockBlobClient . DownloadContentAsync ( ) . Returns ( Response . FromValue (
248+ BlobsModelFactory . BlobDownloadResult ( new BinaryData ( "test-blob" ) ) , null
249+ ) ) ;
250+
251+ _blockBlobClient . GetTagsAsync ( ) . Returns ( Response . FromValue (
252+ BlobsModelFactory . GetBlobTagResult ( new Dictionary < string , string > { { "tag1" , "value1" } } ) , null
253+ ) ) ;
254+
255+ _blockBlobClient . Uri . Returns ( new Uri ( "https://test.blob.core.windows.net/test-blob" ) ) ;
212256 // Act
213257 var result = await _sut . ReadBlobsByTags ( tags , containerName ) ;
214258 // Assert
0 commit comments