mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
03ae6bfa0f
* Bump the dependencies group with 4 updates Bumps BouncyCastle.Cryptography from 2.6.1 to 2.6.2 Bumps Meziantou.Analyzer from 2.0.205 to 2.0.210 Bumps MSTest from 3.9.3 to 3.10.0 Bumps SonarAnalyzer.CSharp from 10.13.0.120203 to 10.15.0.120848 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rob Hague <rob.hague00@gmail.com>
63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using Renci.SshNet.Common;
|
|
|
|
namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
|
{
|
|
/// <summary>
|
|
/// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
|
|
/// </summary>
|
|
public partial class SftpClientTest : IntegrationTestBase
|
|
{
|
|
[TestMethod]
|
|
[TestCategory("Sftp")]
|
|
public void Test_Sftp_DeleteDirectory_Which_Doesnt_Exists()
|
|
{
|
|
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
|
{
|
|
sftp.Connect();
|
|
|
|
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.DeleteDirectory("abcdef"));
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
[TestCategory("Sftp")]
|
|
public void Test_Sftp_DeleteDirectory_Which_No_Permissions()
|
|
{
|
|
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, AdminUser.UserName, AdminUser.Password))
|
|
{
|
|
sftp.Connect();
|
|
|
|
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.DeleteDirectory("/usr"));
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
[TestCategory("Sftp")]
|
|
public void Test_Sftp_DeleteDirectory()
|
|
{
|
|
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
|
{
|
|
sftp.Connect();
|
|
|
|
sftp.CreateDirectory("abcdef");
|
|
sftp.DeleteDirectory("abcdef");
|
|
|
|
sftp.Disconnect();
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
[TestCategory("Sftp")]
|
|
[Description("Test passing null to DeleteDirectory.")]
|
|
public void Test_Sftp_DeleteDirectory_Null()
|
|
{
|
|
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
|
{
|
|
sftp.Connect();
|
|
|
|
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.DeleteDirectory(null));
|
|
}
|
|
}
|
|
}
|
|
}
|