@@ -404,31 +404,14 @@ public async Task Test_Read_File_Async()
404404 var amazonS3Adapter = new AmazonS3Adapter ( "prefix-1" , "root-path-1" , amazonS3Client , "bucket-1" ) ;
405405 var fileSystem = new SharpGrip . FileSystem . FileSystem ( new List < IAdapter > { amazonS3Adapter } ) ;
406406
407- var getObjectResponse1 = Substitute . For < GetObjectResponse > ( ) ;
408- var getObjectResponse2 = Substitute . For < GetObjectResponse > ( ) ;
409- var getObjectResponse3 = Substitute . For < GetObjectResponse > ( ) ;
410-
411- getObjectResponse1 . Key = "test1.txt" ;
412- getObjectResponse1 . ContentLength = 1 ;
413- getObjectResponse1 . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
414-
415- getObjectResponse2 . Key = "test1.txt" ;
416- getObjectResponse2 . ContentLength = 1 ;
417- getObjectResponse2 . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
418-
419- getObjectResponse3 . Key = "test1.txt" ;
420- getObjectResponse3 . ContentLength = 1 ;
421- getObjectResponse3 . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
422- getObjectResponse3 . ResponseStream = new MemoryStream ( "test1"u8 . ToArray ( ) ) ;
423-
424- amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test1.txt" ) . Returns ( getObjectResponse1 , getObjectResponse2 , getObjectResponse3 ) ;
407+ amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test1.txt" ) . Returns ( GetObjectResponse ( "test1.txt" ) , GetObjectResponse ( "test1.txt" ) , GetObjectResponse ( "test1.txt" ) ) ;
425408 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test2.txt" ) . ThrowsAsync ( noSuchKeyException ) ;
426409 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test3.txt" ) . ThrowsAsync ( invalidAccessKeyIdException ) ;
427410 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test4.txt" ) . ThrowsAsync ( invalidSecurityException ) ;
428411
429412 var fileContents = await fileSystem . ReadFileAsync ( "prefix-1://test1.txt" ) ;
430413
431- Assert . Equal ( "test1" , Encoding . UTF8 . GetString ( fileContents ) ) ;
414+ Assert . Equal ( "test1.txt " , Encoding . UTF8 . GetString ( fileContents ) ) ;
432415 await Assert . ThrowsAsync < FileNotFoundException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test2.txt" ) ) ;
433416 await Assert . ThrowsAsync < ConnectionException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test3.txt" ) ) ;
434417 await Assert . ThrowsAsync < ConnectionException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test4.txt" ) ) ;
@@ -458,14 +441,14 @@ public async Task Test_Read_Text_File_Async()
458441 getObjectResponse3 . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
459442 getObjectResponse3 . ResponseStream = new MemoryStream ( "test1"u8 . ToArray ( ) ) ;
460443
461- amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test1.txt" ) . Returns ( getObjectResponse1 , getObjectResponse2 , getObjectResponse3 ) ;
444+ amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test1.txt" ) . Returns ( GetObjectResponse ( "test1.txt" ) , GetObjectResponse ( "test1.txt" ) , GetObjectResponse ( "test1.txt" ) ) ;
462445 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test2.txt" ) . ThrowsAsync ( noSuchKeyException ) ;
463446 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test3.txt" ) . ThrowsAsync ( invalidAccessKeyIdException ) ;
464447 amazonS3Client . GetObjectAsync ( "bucket-1" , "root-path-1/test4.txt" ) . ThrowsAsync ( invalidSecurityException ) ;
465448
466449 var fileContents = await fileSystem . ReadTextFileAsync ( "prefix-1://test1.txt" ) ;
467450
468- Assert . Equal ( "test1" , fileContents ) ;
451+ Assert . Equal ( "test1.txt " , fileContents ) ;
469452 await Assert . ThrowsAsync < FileNotFoundException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test2.txt" ) ) ;
470453 await Assert . ThrowsAsync < ConnectionException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test3.txt" ) ) ;
471454 await Assert . ThrowsAsync < ConnectionException > ( ( ) => fileSystem . ReadFileAsync ( "prefix-1://test4.txt" ) ) ;
0 commit comments