本文整理汇总了C#中SftpClient.DeleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.DeleteDirectory方法的具体用法?C# SftpClient.DeleteDirectory怎么用?C# SftpClient.DeleteDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SftpClient
的用法示例。
在下文中一共展示了SftpClient.DeleteDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Sftp_DeleteDirectory_Without_Connecting
public void Test_Sftp_DeleteDirectory_Without_Connecting()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.DeleteDirectory("test");
}
}
示例2: Test_Sftp_DeleteDirectory_Which_Doesnt_Exists
public void Test_Sftp_DeleteDirectory_Which_Doesnt_Exists()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
sftp.DeleteDirectory("abcdef");
sftp.Disconnect();
}
}
示例3: Test_Sftp_DeleteDirectory_Null
public void Test_Sftp_DeleteDirectory_Null()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
sftp.DeleteDirectory(null);
sftp.Disconnect();
}
}
示例4: Test_Sftp_DeleteDirectory_Which_No_Permissions
public void Test_Sftp_DeleteDirectory_Which_No_Permissions()
{
if (Resources.USERNAME == "root")
Assert.Fail("Must not run this test as root!");
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
sftp.DeleteDirectory("/usr");
sftp.Disconnect();
}
}
示例5: Test_Sftp_Change_Directory
public void Test_Sftp_Change_Directory()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester");
sftp.CreateDirectory("test1");
sftp.ChangeDirectory("test1");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1");
sftp.CreateDirectory("test1_1");
sftp.CreateDirectory("test1_2");
sftp.CreateDirectory("test1_3");
var files = sftp.ListDirectory(".");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory)));
sftp.ChangeDirectory("test1_1");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");
sftp.ChangeDirectory("../test1_2");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_2");
sftp.ChangeDirectory("..");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1");
sftp.ChangeDirectory("..");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester");
files = sftp.ListDirectory("test1/test1_1");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory)));
sftp.ChangeDirectory("test1/test1_1");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");
sftp.ChangeDirectory("/home/tester/test1/test1_1");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");
sftp.ChangeDirectory("/home/tester/test1/test1_1/../test1_2");
Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_2");
sftp.ChangeDirectory("../../");
sftp.DeleteDirectory("test1/test1_1");
sftp.DeleteDirectory("test1/test1_2");
sftp.DeleteDirectory("test1/test1_3");
sftp.DeleteDirectory("test1");
sftp.Disconnect();
}
}
示例6: DeleteDirectoryTest
public void DeleteDirectoryTest()
{
ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value
string path = string.Empty; // TODO: Initialize to an appropriate value
target.DeleteDirectory(path);
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}