2
0

SftpClientTest.GetAttributes.cs 866 B

123456789101112131415161718192021222324252627282930
  1. using System;
  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. public partial class SftpClientTest
  8. {
  9. [TestMethod]
  10. public void GetAttributes_Throws_WhenNotConnected()
  11. {
  12. using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
  13. {
  14. Assert.ThrowsException<SshConnectionException>(() => sftp.GetAttributes("."));
  15. }
  16. }
  17. [TestMethod]
  18. public void GetAttributes_Throws_WhenDisposed()
  19. {
  20. var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
  21. sftp.Dispose();
  22. Assert.ThrowsException<ObjectDisposedException>(() => sftp.GetAttributes("."));
  23. }
  24. }
  25. }