Exemple #1
0
        public void ListDirSuccess()
        {
            SessionData session = new SessionData
            {
                Username = ScpConfig.UserName,
                Password = ScpConfig.Password,
                Host     = ScpConfig.KnownHost,
                Port     = 22
            };

            PscpClient client = new PscpClient(ScpConfig.DefaultOptions, session);

            ListDirectoryResult res = client.ListDirectory(new BrowserFileInfo {
                Path = "."
            });

            Assert.AreEqual(ResultStatusCode.Success, res.StatusCode);
            Assert.Greater(res.Files.Count, 0);
            foreach (BrowserFileInfo file in res.Files)
            {
                Log.Info(file);
            }

            Log.InfoFormat("Result: {0}", res);
        }
Exemple #2
0
        public void ListDirBadPath()
        {
            SessionData session = new SessionData
            {
                Username = ScpConfig.UserName,
                Password = ScpConfig.Password,
                Host     = ScpConfig.KnownHost,
                Port     = 22
            };

            PscpClient client = new PscpClient(ScpConfig.DefaultOptions, session);

            ListDirectoryResult res = client.ListDirectory(new BrowserFileInfo {
                Path = "some_non_existant_dir"
            });

            Assert.AreEqual(ResultStatusCode.Error, res.StatusCode);
            Assert.AreEqual(0, res.Files.Count);
            Assert.IsTrue(res.ErrorMsg != null && res.ErrorMsg.StartsWith("Unable to open"));
            Log.InfoFormat("Result: {0}", res);
        }
Exemple #3
0
        public void ListDirHostNoKey()
        {
            SessionData session = new SessionData
            {
                Username = ScpConfig.UserName,
                Password = ScpConfig.Password,
                Host     = ScpConfig.UnKnownHost,
                Port     = 22
            };

            PscpClient client = new PscpClient(ScpConfig.DefaultOptions, session);

            ListDirectoryResult res = client.ListDirectory(new BrowserFileInfo {
                Path = "."
            });

            Assert.AreEqual(ResultStatusCode.Error, res.StatusCode);
            Assert.AreEqual(res.Files.Count, 0);

            Log.InfoFormat("Result: {0}", res);
        }