public void Test_MoveCopyFolder() { Environment.CurrentDirectory = testFolder; var shell = new CShell(); shell.cd(testFolder); if (Directory.Exists(shell.ResolvePath("test2"))) { shell.rd("test2", recursive: true); } shell.copy("subfolder", "test2"); Assert.IsTrue(File.Exists(Path.Combine(testFolder, "test2", "TestC.txt"))); Assert.IsTrue(File.Exists(Path.Combine(testFolder, "test2", "subfolder2", "TestE.txt"))); shell.move("test2", "test3"); Assert.IsTrue(!Directory.Exists("test2")); Assert.IsTrue(File.Exists(Path.Combine(testFolder, "test3", "TestC.txt"))); Assert.IsTrue(File.Exists(Path.Combine(testFolder, "test3", "subfolder2", "TestE.txt"))); shell.rd("test3", recursive: true); }
public void Test_Createrd() { Environment.CurrentDirectory = testFolder; var shell = new CShell(); string xyz = Path.Combine(testFolder, "xyz"); if (Directory.Exists(xyz)) { Directory.Delete(xyz); } shell.md("xyz"); Assert.IsTrue(Directory.EnumerateDirectories(testFolder).Where(path => Path.GetFileName(path) == "xyz").Any(), "xyz not created"); shell.rd("xyz"); Assert.IsFalse(Directory.EnumerateDirectories(testFolder).Where(path => Path.GetFileName(path) == "xyz").Any(), "xyz not created"); }