@@ -13,7 +13,7 @@ namespace StorageTests;
1313[ TestClass ]
1414public class StorageFileTests
1515{
16- Client Storage => Helpers . GetClient ( ) ;
16+ Client Storage => Helpers . GetServiceClient ( ) ;
1717
1818 private string _bucketId = string . Empty ;
1919 private IStorageFileApi < FileObject > _bucket = null ! ;
@@ -23,7 +23,8 @@ public async Task InitializeTest()
2323 {
2424 _bucketId = Guid . NewGuid ( ) . ToString ( ) ;
2525
26- if ( _bucket == null && await Storage . GetBucket ( _bucketId ) == null )
26+ var exists = await Storage . GetBucket ( _bucketId ) ;
27+ if ( exists == null )
2728 {
2829 await Storage . CreateBucket ( _bucketId , new BucketUpsertOptions { Public = true } ) ;
2930 }
@@ -34,20 +35,17 @@ public async Task InitializeTest()
3435 [ TestCleanup ]
3536 public async Task TestCleanup ( )
3637 {
37- if ( _bucket != null )
38- {
39- var files = await _bucket . List ( ) ;
40-
41- Assert . IsNotNull ( files ) ;
38+ var files = await _bucket . List ( ) ;
4239
43- foreach ( var file in files )
44- {
45- if ( file . Name is not null )
46- await _bucket . Remove ( new List < string > { file . Name } ) ;
47- }
40+ Assert . IsNotNull ( files ) ;
4841
49- await Storage . DeleteBucket ( _bucketId ) ;
42+ foreach ( var file in files )
43+ {
44+ if ( file . Name is not null )
45+ await _bucket . Remove ( new List < string > { file . Name } ) ;
5046 }
47+
48+ await Storage . DeleteBucket ( _bucketId ) ;
5149 }
5250
5351 [ TestMethod ( "File: Upload File" ) ]
0 commit comments