public void TestUserReportedError2() { // clean up anything that may have been left over from previous tests FtpsClient ftp1 = new FtpsClient(FTP_HOST, FTP_STD_PORT, FtpsSecurityProtocol.None); ftp1.NetworkProtocol = NETWORK_PROTOCOL; ftp1.Open(FTP_USER, FTP_PASS); try { ftp1.ChangeDirectory("test dir"); } catch { } try { ftp1.DeleteFile("testfile.txt"); } catch { } try { ftp1.ChangeDirectory("\\"); } catch { } try { ftp1.DeleteDirectory("test dir"); } catch { } FtpsClient ftp = new FtpsClient(FTP_HOST, FTP_STD_PORT, FtpsSecurityProtocol.Tls12Explicit); ftp.NetworkProtocol = NETWORK_PROTOCOL; ftp.AlwaysAcceptServerCertificate = true; ftp.Open(FTP_USER, FTP_PASS); ftp.MakeDirectory("test dir"); ftp.ChangeDirectory("test dir"); ftp.PutFile(GetMemoryStreamRandom(100), "testfile.txt", FileAction.Create); FtpsItemCollection col = ftp.GetDirList(); ftp.Close(); Assert.IsTrue(col.Count == 1); }
public void TestUserReportedError2() { FtpsClient ftp = new FtpsClient(FTP_HOST, FTP_STD_PORT, FtpsSecurityProtocol.Tls1Explicit); ftp.NetworkProtocol = NETWORK_PROTOCOL; ftp.AlwaysAcceptServerCertificate = true; ftp.Open(FTP_USER, FTP_PASS); ftp.MakeDirectory("test dir"); ftp.ChangeDirectory("test dir"); ftp.PutFile(GetMemoryStreamRandom(100), "testfile.txt", FileAction.Create); FtpsItemCollection col = ftp.GetDirList(); ftp.DeleteFile("testfile.txt"); ftp.ChangeDirectory("\\"); ftp.DeleteDirectory("test dir"); ftp.Close(); Assert.IsTrue(col.Count == 1); }
public void TestGetDirList(string host, int port, FtpsSecurityProtocol protocol, string user, string pwd, string server) { using (FtpsClient c = new FtpsClient(host, port, protocol)) { c.AlwaysAcceptServerCertificate = true; c.Open(user, pwd); Assert.IsTrue(c.IsConnected); FtpsItemCollection lst = c.GetDirList(); Debug.WriteLine("==================================================="); Debug.WriteLine("DIRECTORY DUMP"); Debug.WriteLine("==================================================="); foreach (FtpsItem item in lst) { Debug.WriteLine(item.RawText); Debug.WriteLine(item.ToString()); } Debug.WriteLine("==================================================="); } }