-
-
Notifications
You must be signed in to change notification settings - Fork 980
Expand file tree
/
Copy pathSftpClientTest.DeleteDirectory.cs
More file actions
62 lines (53 loc) · 1.95 KB
/
SftpClientTest.DeleteDirectory.cs
File metadata and controls
62 lines (53 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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));
}
}
}
}