Clean implementation of FTP File Cleaners I was refactoring some of my utility code modules used in my test projects, and wanted to apply my knowledge of clean OOP design patterns and SOLID principles to make these modules more useful and easier to use.

I have an interface called IFtpFileCleaner:

/// &lt;summary&gt;
/// Responsible for deleting a single file located in a remote server
/// &lt;/summary&gt;
public interface IFtpFileCleaner
{
    /// &lt;summary&gt;
    /// Deletes a remote file
    /// &lt;/summary&gt;
    /// &lt;param name="remotePath"&gt;
    /// The full remote path.
    /// &lt;/param&gt;
    void Clean(string remotePath);
}


I have an abstract class called RemoteFileCleaner, which implements IFtpFileCleaner:

/// &lt;summary&gt;
/// The file cleaner base class provides common code for all the implementations to reduce code duplication
/// &lt;/summary&gt;
public abstract class RemoteFileCleaner : IFtpFileCleaner
{
    /// &lt;summary&gt;
    /// The FTP _client.
    /// &lt;/summary&gt;
    private readonly IFtpSecureClient _client;

    /// &lt;summary&gt;
    /// Initializes a new instance of the &lt;see cref="RemoteFileCleaner"/&gt; class.
    /// &lt;/summary&gt;
    /// &lt;param name="client"&gt;
    /// The FTP client.
    /// &lt;/param&gt;
    protected RemoteFileCleaner(IFtpSecureClient client)
    {
        _client = client;
    }

    /// &lt;summary&gt;
    /// Deletes a single file located on a remote server
    /// &lt;/summary&gt;
    /// &lt;param name="remotePath"&gt;
    /// The full path of the remote file.
    /// &lt;/param&gt;
    public void Clean(string remotePath)
    {
        try
        {
            _client.Init();
            _client.DeleteFile(remotePath);
        }
        catch (Exception e)
        {
            Console.WriteLine($"Failed to clean file {remotePath}.{Environment.NewLine}{e}");
            throw;
        }
        finally
        {
            _client.Disconnect();
        }
        Console.WriteLine($"Remote File {remotePath} was deleted.");
    }
}


Now, I can have concrete implementations of my file cleaners. Like SFTPFileCleaner, FTPFileCleaner, and FTPSFileCleaner. They all look very similar. For instance, SFTPFileCleaner looks like this:

/// &lt;summary&gt;
/// The SFTP implementation of &lt;see cref="RemoteFileCleaner"/&gt;.
/// &lt;/summary&gt;
public class SFTPFileCleaner : RemoteFileCleaner
{
    /// &lt;summary&gt;
    /// Initializes a new instance of the &lt;see cref="SFTPFileCleaner"/&gt; class.
    /// &lt;/summary&gt;
    public SFTPFileCleaner()
        : base(new FtpSecureClientTestFactory().CreateSFTPClient())
    {
    }
}


As you can see, I am performing "Bastard Injection" here in the concrete implementation because I would like to easily instantiate these cleaners in my test methods. Here is an example:

[TearDown]
public void Cleanup()
{
    _ftpCleaner = new SFTPFileCleaner();
    _ftpCleaner.Clean(_expectedRemotePath);
}



What do you guys think about this design? Is it clean and easy to use?
Can it be improved any further?
Is there a name for this design pattern? To me is seems to be the mixture of Facade Pattern (Bastard Injection) and Strategy Pattern. Am I correct?
Wouldn't it make more sense to have IRemoteFileCleaner as the base class, and have FTPFileCleaner (which inherits from IRemoteFileCleaner as the class which all the others inherit from?