we have code that persists a file and I would like to check the content of the file during testing. I though that such scenario will be best implemented if I abstract the file persistence operation to the following interface:
public interface IFilePersist
{
void Save(XXX, FileLocation);
}
In unit testing I will inject the mock that will check the content and in production the interface will be actually persist to right location.
Is it an overhead? Is this practice commonly used? For DB related operations this kind of operation is trivial and always used.