I'm currently using an Open Source FTP library in all my projects as I've never managed to code a decent FTP Helper Library based on the C# 4.0 API.
What do you think about this approach? I'm not quite versed in TDD but ideally I'd like to make this class as testable as possible.
public void DownloadFile(string host, string file, string user, string pass, string path)
{
if (!String.IsNullOrWhiteSpace(host) && !String.IsNullOrWhiteSpace(file))
{
Uri addr = new Uri(host + file);
using (WebClient client = new WebClient())
{
if (!String.IsNullOrWhiteSpace(user) && !String.IsNullOrWhiteSpace(pass))
{
client.Credentials = new NetworkCredential(user, pass);
}
if (!String.IsNullOrWhiteSpace(path))
{
client.DownloadFile(addr, path);
}
}
}
}