using Microsoft.VisualStudio.TestTools.UnitTesting; using Renci.SshNet.Common; using Renci.SshNet.Tests.Properties; namespace Renci.SshNet.Tests.Classes { /// /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH. /// public partial class SftpClientTest { [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] [ExpectedException(typeof(SftpPathNotFoundException))] public void Test_Sftp_ChangeDirectory_Root_Dont_Exists() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/asdasd"); } } [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] [ExpectedException(typeof(SftpPathNotFoundException))] public void Test_Sftp_ChangeDirectory_Root_With_Slash_Dont_Exists() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/asdasd/"); } } [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] [ExpectedException(typeof(SftpPathNotFoundException))] public void Test_Sftp_ChangeDirectory_Subfolder_Dont_Exists() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/asdasd/sssddds"); } } [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] [ExpectedException(typeof(SftpPathNotFoundException))] public void Test_Sftp_ChangeDirectory_Subfolder_With_Slash_Dont_Exists() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/asdasd/sssddds/"); } } [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] public void Test_Sftp_ChangeDirectory_Which_Exists() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/usr"); Assert.AreEqual("/usr", sftp.WorkingDirectory); } } [TestMethod] [TestCategory("Sftp")] [TestCategory("integration")] public void Test_Sftp_ChangeDirectory_Which_Exists_With_Slash() { using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) { sftp.Connect(); sftp.ChangeDirectory("/usr/"); Assert.AreEqual("/usr", sftp.WorkingDirectory); } } } }