@@ -513,7 +513,8 @@ internal static async Task ListBuckets_Test(MinioClient minio)
513513 {
514514 var list = await minio . ListBucketsAsync ( ) . ConfigureAwait ( false ) ;
515515 bucketList = list . Buckets ;
516- bucketList = bucketList . Where ( x => x . Name . EndsWith ( bucketNameSuffix ) ) . ToList ( ) ;
516+ bucketList = bucketList . Where ( x => x . Name . EndsWith ( bucketNameSuffix , StringComparison . OrdinalIgnoreCase ) )
517+ . ToList ( ) ;
517518 Assert . AreEqual ( noOfBuckets , bucketList . Count ) ;
518519 bucketList . ToList ( ) . Sort ( ( x , y ) =>
519520 {
@@ -729,7 +730,7 @@ internal static async Task PutGetStatEncryptedObject_Test1(MinioClient minio)
729730 . WithObjectSize ( filestream . Length )
730731 . WithServerSideEncryption ( ssec )
731732 . WithContentType ( contentType ) ;
732- await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
733+ _ = await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
733734
734735 var getObjectArgs = new GetObjectArgs ( )
735736 . WithBucket ( bucketName )
@@ -752,8 +753,8 @@ internal static async Task PutGetStatEncryptedObject_Test1(MinioClient minio)
752753 . WithBucket ( bucketName )
753754 . WithObject ( objectName )
754755 . WithServerSideEncryption ( ssec ) ;
755- await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
756- await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
756+ _ = await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
757+ _ = await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
757758 }
758759
759760 new MintLogger ( "PutGetStatEncryptedObject_Test1" , putObjectSignature ,
@@ -816,7 +817,7 @@ internal static async Task PutGetStatEncryptedObject_Test2(MinioClient minio)
816817 . WithObjectSize ( filestream . Length )
817818 . WithContentType ( contentType )
818819 . WithServerSideEncryption ( ssec ) ;
819- await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
820+ _ = await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
820821
821822 var getObjectArgs = new GetObjectArgs ( )
822823 . WithBucket ( bucketName )
@@ -839,8 +840,8 @@ internal static async Task PutGetStatEncryptedObject_Test2(MinioClient minio)
839840 . WithBucket ( bucketName )
840841 . WithObject ( objectName )
841842 . WithServerSideEncryption ( ssec ) ;
842- await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
843- await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
843+ _ = await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
844+ _ = await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
844845 }
845846
846847 new MintLogger ( "PutGetStatEncryptedObject_Test2" , putObjectSignature ,
@@ -901,7 +902,7 @@ internal static async Task PutGetStatEncryptedObject_Test3(MinioClient minio)
901902 . WithObjectSize ( filestream . Length )
902903 . WithServerSideEncryption ( sses3 )
903904 . WithContentType ( contentType ) ;
904- await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
905+ _ = await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
905906
906907 var getObjectArgs = new GetObjectArgs ( )
907908 . WithBucket ( bucketName )
@@ -922,8 +923,8 @@ internal static async Task PutGetStatEncryptedObject_Test3(MinioClient minio)
922923 var statObjectArgs = new StatObjectArgs ( )
923924 . WithBucket ( bucketName )
924925 . WithObject ( objectName ) ;
925- await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
926- await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
926+ _ = await minio . StatObjectAsync ( statObjectArgs ) . ConfigureAwait ( false ) ;
927+ _ = await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
927928 }
928929
929930 new MintLogger ( "PutGetStatEncryptedObject_Test3" , putObjectSignature ,
@@ -1308,7 +1309,7 @@ internal static async Task DownloadObjectAsync(MinioClient minio, string url, st
13081309 {
13091310 using var response = await minio . WrapperGetAsync ( url ) . ConfigureAwait ( false ) ;
13101311 if ( string . IsNullOrEmpty ( Convert . ToString ( response . Content ) ) || ! HttpStatusCode . OK . Equals ( response . StatusCode ) )
1311- throw new ArgumentNullException ( nameof ( response . Content ) , "Unable to download via presigned URL" ) ;
1312+ throw new InvalidOperationException ( "Unable to download via presigned URL" + nameof ( response . Content ) ) ;
13121313
13131314 using var fs = new FileStream ( filePath , FileMode . CreateNew ) ;
13141315 await response . Content . CopyToAsync ( fs , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -1340,7 +1341,9 @@ internal static async Task PresignedPostPolicy_Test1(MinioClient minio)
13401341 var args = new Dictionary < string , string >
13411342 ( StringComparer . Ordinal )
13421343 {
1343- { "bucketName" , bucketName } , { "objectName" , objectName } , { "expiresOn" , expiresOn . ToString ( ) }
1344+ { "bucketName" , bucketName } ,
1345+ { "objectName" , objectName } ,
1346+ { "expiresOn" , expiresOn . ToString ( CultureInfo . InvariantCulture ) }
13441347 } ;
13451348
13461349 // File to be uploaded
@@ -2160,6 +2163,7 @@ internal static async Task ObjectVersioningAsync_Test1(MinioClient minio)
21602163
21612164 #region Object Lock Configuration
21622165
2166+ [ SuppressMessage ( "Design" , "MA0051:Method is too long" , Justification = "TODO" ) ]
21632167 internal static async Task ObjectLockConfigurationAsync_Test1 ( MinioClient minio )
21642168 {
21652169 var startTime = DateTime . Now ;
@@ -2376,9 +2380,8 @@ internal static async Task ObjectRetentionAsync_Test1(MinioClient minio)
23762380 . WithRetentionUntilDate ( untilDate ) ;
23772381 await minio . SetObjectRetentionAsync ( setRetentionArgs ) . ConfigureAwait ( false ) ;
23782382 new MintLogger ( nameof ( ObjectRetentionAsync_Test1 ) , setObjectRetentionSignature ,
2379- "Tests whether SetObjectRetentionAsync passes" , TestStatus . PASS , DateTime . Now - startTime ,
2380- args : args )
2381- . Log ( ) ;
2383+ "Tests whether SetObjectRetentionAsync passes" , TestStatus . PASS , DateTime . Now - startTime ,
2384+ args : args ) . Log ( ) ;
23822385 }
23832386 catch ( NotImplementedException ex )
23842387 {
@@ -2407,9 +2410,8 @@ internal static async Task ObjectRetentionAsync_Test1(MinioClient minio)
24072410 var untilDate = DateTime . Parse ( config . RetainUntilDate , null , DateTimeStyles . RoundtripKind ) ;
24082411 Assert . AreEqual ( Math . Ceiling ( ( untilDate - DateTime . Now ) . TotalDays ) , plusDays ) ;
24092412 new MintLogger ( nameof ( ObjectRetentionAsync_Test1 ) , getObjectRetentionSignature ,
2410- "Tests whether GetObjectRetentionAsync passes" , TestStatus . PASS , DateTime . Now - startTime ,
2411- args : args )
2412- . Log ( ) ;
2413+ "Tests whether GetObjectRetentionAsync passes" , TestStatus . PASS , DateTime . Now - startTime ,
2414+ args : args ) . Log ( ) ;
24132415 }
24142416 catch ( NotImplementedException ex )
24152417 {
@@ -2809,8 +2811,8 @@ void Notify(MinioNotificationRaw data)
28092811 rxEventData = ev ;
28102812 Notify ( rxEventData ) ;
28112813 } ,
2812- ex => throw new ArgumentException ( $ "OnError: { ex . Message } ") ,
2813- ( ) => throw new ArgumentException ( "STOPPED LISTENING FOR BUCKET NOTIFICATIONS\n " ) ) ;
2814+ ex => throw new InvalidOperationException ( $ "OnError: { ex . Message } ") ,
2815+ ( ) => throw new InvalidOperationException ( "STOPPED LISTENING FOR BUCKET NOTIFICATIONS\n " ) ) ;
28142816
28152817 // Sleep to give enough time for the subscriber to be ready
28162818 var sleepTime = 1000 ; // Milliseconds
@@ -2836,7 +2838,7 @@ void Notify(MinioNotificationRaw data)
28362838 {
28372839 await Task . Delay ( waitTime ) . ConfigureAwait ( false ) ;
28382840 if ( ( DateTime . UtcNow - stTime ) . TotalMilliseconds >= timeout )
2839- throw new ArgumentException ( "Timeout: while waiting for events" ) ;
2841+ throw new TimeoutException ( "Timeout: while waiting for events" ) ;
28402842 }
28412843
28422844 foreach ( var ev in rxEventsList ) Assert . AreEqual ( "s3:ObjectCreated:Put" , ev . EventName ) ;
@@ -2922,7 +2924,7 @@ internal static async Task ListenBucketNotificationsAsync_Test3(MinioClient mini
29222924 {
29232925 await Task . Delay ( waitTime ) . ConfigureAwait ( false ) ;
29242926 if ( ( DateTime . UtcNow - stTime ) . TotalMilliseconds >= timeout )
2925- throw new ArgumentException ( "Timeout: while waiting for events" ) ;
2927+ throw new TimeoutException ( "Timeout: while waiting for events" ) ;
29262928 }
29272929
29282930 if ( ! string . IsNullOrEmpty ( rxEventData . json ) )
@@ -2941,7 +2943,7 @@ internal static async Task ListenBucketNotificationsAsync_Test3(MinioClient mini
29412943 }
29422944 else
29432945 {
2944- throw new ArgumentException ( "Missed Event: Bucket notification failed." ) ;
2946+ throw new InvalidDataException ( "Missed Event: Bucket notification failed." ) ;
29452947 }
29462948 }
29472949 catch ( Exception ex )
@@ -4638,7 +4640,7 @@ internal static async Task GetObject_Test1(MinioClient minio)
46384640 . WithStreamData ( filestream )
46394641 . WithObjectSize ( filestream . Length )
46404642 . WithContentType ( contentType ) ;
4641- await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
4643+ _ = await minio . PutObjectAsync ( putObjectArgs ) . ConfigureAwait ( false ) ;
46424644
46434645 var getObjectArgs = new GetObjectArgs ( )
46444646 . WithBucket ( bucketName )
@@ -4656,7 +4658,7 @@ internal static async Task GetObject_Test1(MinioClient minio)
46564658 Assert . AreEqual ( file_write_size , file_read_size ) ;
46574659 File . Delete ( tempFileName ) ;
46584660 } ) ;
4659- await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
4661+ _ = await minio . GetObjectAsync ( getObjectArgs ) . ConfigureAwait ( false ) ;
46604662 }
46614663
46624664 await Task . Delay ( 1000 ) . ConfigureAwait ( false ) ;
@@ -5236,7 +5238,7 @@ internal static async Task ListObjects_Test6(MinioClient minio)
52365238 var subscription = observable . Subscribe (
52375239 item =>
52385240 {
5239- Assert . IsTrue ( item . Key . StartsWith ( objectNamePrefix ) ) ;
5241+ Assert . IsTrue ( item . Key . StartsWith ( objectNamePrefix , StringComparison . OrdinalIgnoreCase ) ) ;
52405242 if ( ! objectNamesSet . Add ( item . Key ) )
52415243 new MintLogger ( "ListObjects_Test6" , listObjectsSignature ,
52425244 "Tests whether ListObjects lists more than 1000 objects correctly(max-keys = 1000)" ,
@@ -5309,7 +5311,7 @@ internal static async Task ListObjectVersions_Test1(MinioClient minio)
53095311 var subscription = observable . Subscribe (
53105312 item =>
53115313 {
5312- Assert . IsTrue ( item . Key . StartsWith ( prefix ) ) ;
5314+ Assert . IsTrue ( item . Key . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ) ;
53135315 count ++ ;
53145316 objectVersions . Add ( new Tuple < string , string > ( item . Key , item . VersionId ) ) ;
53155317 } ,
@@ -5526,7 +5528,7 @@ internal static async Task PresignedGetObject_Test3(MinioClient minio)
55265528 "reqParams" ,
55275529 "response-content-type:application/json,response-content-disposition:attachment;filename= MyDoc u m e nt.json ;"
55285530 } ,
5529- { "reqDate" , reqDate . ToString ( ) }
5531+ { "reqDate" , reqDate . ToString ( CultureInfo . InvariantCulture ) }
55305532 } ;
55315533 try
55325534 {
@@ -5562,7 +5564,7 @@ internal static async Task PresignedGetObject_Test3(MinioClient minio)
55625564
55635565 using var response = await minio . WrapperGetAsync ( presigned_url ) . ConfigureAwait ( false ) ;
55645566 if ( response . StatusCode != HttpStatusCode . OK || string . IsNullOrEmpty ( Convert . ToString ( response . Content ) ) )
5565- throw new ArgumentNullException ( nameof ( response . Content ) , "Unable to download via presigned URL" ) ;
5567+ throw new InvalidOperationException ( "Unable to download via presigned URL " + nameof ( response . Content ) ) ;
55665568
55675569 Assert . IsTrue ( response . Content . Headers . GetValues ( "Content-Type" )
55685570 . Contains ( reqParams [ "response-content-type" ] , StringComparer . Ordinal ) ) ;
0 commit comments