@@ -194,6 +194,35 @@ public async Task GetFileUrlWithCyrillicName()
194194 . Should ( ) . BeTrue ( response . ReasonPhrase ) ;
195195 }
196196
197+ [ Fact ]
198+ public async Task HasValidUploadInformation ( )
199+ {
200+ var fileName = _fixture . Create < string > ( ) ;
201+
202+ using var uploader = await _client . UploadFile ( fileName , StreamContentType , _ct ) ;
203+
204+ uploader
205+ . FileName
206+ . Should ( ) . Be ( fileName ) ;
207+
208+ uploader
209+ . UploadId
210+ . Should ( ) . NotBeEmpty ( ) ;
211+
212+ uploader
213+ . Written
214+ . Should ( ) . Be ( 0 ) ;
215+
216+ var partData = new byte [ ] { 1 , 2 , 3 } ;
217+ await uploader . AddPart ( partData , _ct ) ;
218+
219+ uploader
220+ . Written
221+ . Should ( ) . Be ( partData . Length ) ;
222+
223+ await uploader . Abort ( _ct ) ;
224+ }
225+
197226 [ Fact ]
198227 public async Task HasValidInformation ( )
199228 {
@@ -334,6 +363,30 @@ public async Task PutBigStream()
334363 await DeleteTestFile ( fileName ) ;
335364 }
336365
366+ [ Fact ]
367+ public async Task ReadFileStream ( )
368+ {
369+ var fileName = await CreateTestFile ( ) ;
370+
371+ var buffer = new byte [ 1024 ] ;
372+ var file = await _client . GetFile ( fileName , _ct ) ;
373+ var fileStream = await file . GetStream ( _ct ) ;
374+
375+ #pragma warning disable CA1835
376+ var read = await fileStream . ReadAsync ( buffer , _ct ) ;
377+ read . Should ( ) . BeGreaterThan ( 0 ) ;
378+
379+ read = await fileStream . ReadAsync ( buffer , 10 , 20 , _ct ) ;
380+ read . Should ( ) . BeGreaterThan ( 0 ) ;
381+
382+ // ReSharper disable once MethodHasAsyncOverloadWithCancellation
383+ read = fileStream . Read ( buffer , 10 , 20 ) ;
384+ read . Should ( ) . BeGreaterThan ( 0 ) ;
385+ #pragma warning restore CA1835
386+
387+ await DeleteTestFile ( fileName ) ;
388+ }
389+
337390 [ Fact ]
338391 public async Task Upload ( )
339392 {
@@ -425,6 +478,15 @@ public Task NotThrowIfDeleteFileNotExists()
425478 . Should ( ) . NotThrowAsync ( ) ;
426479 }
427480
481+ [ Fact ]
482+ public async Task NotThrowIfGetFileStreamNotFound ( )
483+ {
484+ var fileName = _fixture . Create < string > ( ) ;
485+ await _client
486+ . Invoking ( client => client . GetFileStream ( fileName , _ct ) )
487+ . Should ( ) . NotThrowAsync ( ) ;
488+ }
489+
428490 [ Fact ]
429491 public async Task ThrowIfBucketNotExists ( )
430492 {
@@ -445,6 +507,27 @@ await _notExistsBucketClient
445507 . Should ( ) . ThrowAsync < HttpRequestException > ( ) ;
446508 }
447509
510+ [ Fact ]
511+ public async Task ThrowIfUploadDisposed ( )
512+ {
513+ var fileName = _fixture . Create < string > ( ) ;
514+
515+ var uploader = await _client . UploadFile ( fileName , StreamContentType , _ct ) ;
516+ uploader . Dispose ( ) ;
517+
518+ await uploader
519+ . Invoking ( u => u . Abort ( _ct ) )
520+ . Should ( ) . ThrowExactlyAsync < ObjectDisposedException > ( ) ;
521+
522+ await uploader
523+ . Invoking ( u => u . AddPart ( [ ] , 0 , _ct ) )
524+ . Should ( ) . ThrowExactlyAsync < ObjectDisposedException > ( ) ;
525+
526+ await uploader
527+ . Invoking ( u => u . Complete ( _ct ) )
528+ . Should ( ) . ThrowExactlyAsync < ObjectDisposedException > ( ) ;
529+ }
530+
448531 private async Task < string > CreateTestFile (
449532 string ? fileName = null ,
450533 string contentType = StreamContentType ,
0 commit comments