C
C#12mo ago
Guru

❔ s3 xunit mock

How to write an xunit mock for Amazon s3 bucket
3 Replies
jcotton42
jcotton4212mo ago
we're going to need more details like, how are you talking to S3?
cumslvt13
cumslvt1312mo ago
Probably in your code you're using IAmazonS3 interface in order to upload/download files you can try to mock that, since that's an interface. But I usually create my own abstraction like IFileStorage with a couple of methods like UploadFileAsync and DownloadFileAsync and just setup mocks on this methods in order to test if they're called with expected data. That's it. For mocking you can use libraries like NSubsitute of Moq
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.