11using System ;
22using System . Threading . Tasks ;
3- using Amazon ;
43using Amazon . S3 ;
54using Amazon . S3 . Model ;
6- using Moq ;
5+ using NSubstitute ;
76using SharpGrip . FileSystem . Adapters . AmazonS3 ;
87using SharpGrip . FileSystem . Models ;
98using Xunit ;
@@ -15,8 +14,8 @@ public class AmazonS3AdapterTest
1514 [ Fact ]
1615 public void Test_Instantiation ( )
1716 {
18- var amazonS3Client = new Mock < AmazonS3Client > ( "awsAccessKeyId" , "awsSecretAccessKey" , RegionEndpoint . USEast2 ) ;
19- var amazonS3Adapter = new AmazonS3Adapter ( "prefix" , "/root-path" , amazonS3Client . Object , "bucket" ) ;
17+ var amazonS3Client = Substitute . For < IAmazonS3 > ( ) ;
18+ var amazonS3Adapter = new AmazonS3Adapter ( "prefix" , "/root-path" , amazonS3Client , "bucket" ) ;
2019
2120 Assert . Equal ( "prefix" , amazonS3Adapter . Prefix ) ;
2221 Assert . Equal ( "/root-path" , amazonS3Adapter . RootPath ) ;
@@ -25,17 +24,16 @@ public void Test_Instantiation()
2524 [ Fact ]
2625 public async Task Test_Get_File_Async ( )
2726 {
28- var amazonS3Client = new Mock < AmazonS3Client > ( "awsAccessKeyId" , "awsSecretAccessKey" , RegionEndpoint . USEast2 ) ;
29- var amazonS3Adapter = new AmazonS3Adapter ( "prefix-1" , "/root-path-1" , amazonS3Client . Object , "bucket-1" ) ;
27+ var amazonS3Client = Substitute . For < IAmazonS3 > ( ) ;
28+ var amazonS3Adapter = new AmazonS3Adapter ( "prefix-1" , "/root-path-1" , amazonS3Client , "bucket-1" ) ;
3029
31- var getObjectResponse = new Mock < GetObjectResponse > ( ) ;
30+ var getObjectResponse = Substitute . For < GetObjectResponse > ( ) ;
3231
33- getObjectResponse . SetupAllProperties ( ) ;
34- getObjectResponse . Object . Key = "test.txt" ;
35- getObjectResponse . Object . ContentLength = 1 ;
36- getObjectResponse . Object . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
32+ getObjectResponse . Key = "test.txt" ;
33+ getObjectResponse . ContentLength = 1 ;
34+ getObjectResponse . LastModified = new DateTime ( 1970 , 1 , 1 ) ;
3735
38- amazonS3Client . Setup ( o => o . GetObjectAsync ( "bucket-1" , "/root-path-1/test.txt" , default ) ) . ReturnsAsync ( getObjectResponse . Object ) ;
36+ amazonS3Client . GetObjectAsync ( "bucket-1" , "/root-path-1/test.txt" ) . Returns ( getObjectResponse ) ;
3937
4038 var fileModel = new FileModel
4139 {
0 commit comments