public void UploadFileTest() { var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(Host, Port); var operationPerformer = new OperationPerformer(socket); operationPerformer.OmitWelcomeResponse(); operationPerformer.LogIn(Username, Password); operationPerformer.ActiveMode = false; operationPerformer.UploadFile("haha.txt", "G:\\hp\\Desktop\\test1.txt"); var fileList = operationPerformer.ListFiles("/"); Assert.IsTrue(fileList.FindIndex(x => x.Name == "haha.txt") >= 0); operationPerformer.ActiveMode = true; operationPerformer.UploadFile("hehe.txt", "G:\\hp\\Desktop\\test1.txt"); fileList = operationPerformer.ListFiles("/"); Assert.IsTrue(fileList.FindIndex(x => x.Name == "hehe.txt") >= 0); operationPerformer.LogOut(); Assert.IsTrue(true); }
public void RenameFileTest() { var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(Host, Port); var operationPerformer = new OperationPerformer(socket); operationPerformer.OmitWelcomeResponse(); operationPerformer.LogIn(Username, Password); operationPerformer.DownloadFile("FTP.txt", "haha.txt"); operationPerformer.UploadFile("haha.txt", "haha.txt"); operationPerformer.RenameFile("haha.txt", "hehe.txt"); Assert.IsTrue(true); }