robinrodricks / FluentStorage

A polycloud .NET cloud storage abstraction layer. Provides Blob storage (AWS S3, GCP, FTP, SFTP, Azure Blob/File/Event Hub/Data Lake) and Messaging (AWS SQS, Azure Queue/ServiceBus). Supports .NET 5+ and .NET Standard 2.0+. Pure C#.
MIT License
263 stars 33 forks source link

use IFileSystem to improve testability of DiskDirectoryBlobStorage #71

Open gerrewsb opened 1 month ago

gerrewsb commented 1 month ago

Description

Improves testability of DiskDirectoryBlobStorage

robinrodricks commented 1 month ago

This is a good idea.

However, it adds a mandatory dependency into the base FluentStorage package for a less than common use case (local disk). Can you justify this or let me know why its important in the first place?

As I see no tests have been added, so what do you mean by "testability"?

gerrewsb commented 1 month ago

I meant that devs that use FluentStorage can use the DiskDirectoryBlobStorage in their unit tests can inject a MockFileSystem in there so their actual filesystem isn't used for the unit tests. Otherwise they would have to mock the IBlobStorage or use the InMemory variant in their tests. Both are valid options but they still differ a bit from using the actual DiskDirectoryBlobStorage. One could even go deeper and mock a MockFileSystem so the behaviour of a full disk or insufficient writing priviliges can be tested.

Its also a very small library to depend on. It'll hardly make FluentStorage bigger.