Exemple #1
0
        private SftpClient TestConnection(SftpOptions options)
        {
            SftpClient client    = new SftpClient();
            bool       connected = client.Connect(options);

            True(connected, client);
            return(client);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        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();
        }
Exemple #5
0
 public abstract bool Connect(SftpOptions options);