public void ChangeDirectoryTest() { 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.ChangeDirectory(".."); operationPerformer.ChangeDirectory("."); operationPerformer.ChangeDirectory(".settings"); operationPerformer.ChangeDirectory(".././../.settings/../."); operationPerformer.LogOut(); Assert.IsTrue(true); }
public void RemoveDirectoryTest() { 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); try { operationPerformer.RemoveDirectory("testDir/testR"); } catch (Exception) { // ignored } try { operationPerformer.RemoveDirectory("testDir"); } catch (Exception) { // ignored } operationPerformer.MakeDirectory("testDir"); operationPerformer.MakeDirectory("testDir/testR"); operationPerformer.ChangeDirectory("testDir"); operationPerformer.RemoveDirectory("testR"); Assert.IsTrue(operationPerformer.ListFiles().Count == 2); operationPerformer.ChangeDirectory(".."); operationPerformer.RemoveDirectory("testDir"); Assert.IsTrue(operationPerformer.ListFiles().FindIndex(x => x.Name == "testDir") == -1); operationPerformer.LogOut(); Assert.IsTrue(true); }