private SftpClient TestConnection(SftpOptions options) { SftpClient client = new SftpClient(); bool connected = client.Connect(options); True(connected, client); return(client); }
public void TestWithUserPassword() { SftpOptions options = new SftpOptions(); options.Host = host; options.User = user; options.Password = password; options.AllowHostKeyChecking = false; SftpClient client = TestConnection(options); TestPut(client); TestGet(client); client.Disconnect(); }
public void TestWithKeyAndKnown_Hosts() { SftpOptions options = new SftpOptions(); options.Host = host; options.User = user; options.Password = password; options.AllowHostKeyChecking = true; options.KeyPassword = keyPassword; options.KnownHostsPath = known_hosts; SftpClient client = TestConnection(options); TestPut(client); TestGet(client); client.Disconnect(); }
public void TestRoot() { SftpOptions o = new SftpOptions(); o.Host = host; o.User = user; o.Password = password; o.AllowHostKeyChecking = false; SftpClient c = new SftpClient(); c.Connect(o); bool put = c.Put(localPath, "/"); True(put, c); bool get = c.Get("sftptest1.txt", localPath); True(get, c); c.Disconnect(); }
public abstract bool Connect(SftpOptions options);