2
0

SftpClientTest.ListDirectory.cs 864 B

123456789101112131415161718192021222324252627282930
  1. using System.Diagnostics;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Renci.SshNet.Common;
  4. using Renci.SshNet.Tests.Properties;
  5. namespace Renci.SshNet.Tests.Classes
  6. {
  7. /// <summary>
  8. /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
  9. /// </summary>
  10. public partial class SftpClientTest
  11. {
  12. [TestMethod]
  13. [TestCategory("Sftp")]
  14. [ExpectedException(typeof(SshConnectionException))]
  15. public void Test_Sftp_ListDirectory_Without_Connecting()
  16. {
  17. using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
  18. {
  19. var files = sftp.ListDirectory(".");
  20. foreach (var file in files)
  21. {
  22. Debug.WriteLine(file.FullName);
  23. }
  24. }
  25. }
  26. }
  27. }