The main purpose of IFtp
was to make it possible to easily write code that works with both Ftp
(part of Rebex FTP/SSL) and Sftp
(part of Rebex SFTP) objects and only the feaures supported by both protocols were included. Unit testing was not one of the design goals.
For the purpose of unit testing, I would recommend extending the IFtp
interface and Ftp
object by inheriting from them, like this:
public interface IFtp2 : IFtp
{
string Connect(string serverName, int serverPort, SslMode security);
bool Passive { get; set; }
FtpExtensions EnabledExtensions { get; set; }
}
public class Ftp2 : Ftp, IFtp2
{
string IFtp2.Connect(string serverName, int serverPort, SslMode security)
{
return Connect(serverName, serverPort, security);
}
bool IFtp2.Passive
{
get { return Passive; }
set { Passive = value; }
}
FtpExtensions IFtp2.EnabledExtensions
{
get { return EnabledExtensions; }
set { EnabledExtensions = value; }
}
}
This way, it's quite simple to add the missing functionality without the need to re-implement the whole IFtp interface.