2
0

SftpClientTest.GetAttributes.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Renci.SshNet.Common;
  2. namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
  3. {
  4. public partial class SftpClientTest
  5. {
  6. [TestMethod]
  7. [TestCategory("Sftp")]
  8. public void Test_Sftp_GetAttributes_Not_Exists()
  9. {
  10. using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
  11. {
  12. sftp.Connect();
  13. Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.GetAttributes("/asdfgh"));
  14. }
  15. }
  16. [TestMethod]
  17. [TestCategory("Sftp")]
  18. public void Test_Sftp_GetAttributes_Null()
  19. {
  20. using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
  21. {
  22. sftp.Connect();
  23. Assert.ThrowsException<ArgumentNullException>(() => sftp.GetAttributes(null));
  24. }
  25. }
  26. [TestMethod]
  27. [TestCategory("Sftp")]
  28. public void Test_Sftp_GetAttributes_Current()
  29. {
  30. using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
  31. {
  32. sftp.Connect();
  33. var attributes = sftp.GetAttributes(".");
  34. Assert.IsNotNull(attributes);
  35. sftp.Disconnect();
  36. }
  37. }
  38. }
  39. }