public void TestMethod1() { List<File> file = new List<File>(); Directory C = new Directory("C:", null); File CurrentFile = C; Assert.AreEqual(null, CurrentFile.ls()); }
public void TestMethod3() { Directory C = new Directory("C:", null); Directory CurrentFile = C; Directory Test = new Directory("Test", C); C.file.Add(Test); Assert.AreEqual(C.file, CurrentFile.ls()); }
public void TestMethod1() { Directory C = new Directory("C:", null); File CurrentFile = C; File Test = new File("Test", C); C.file.Add(Test); Assert.AreEqual(Test ,CurrentFile.cd("Test")); }
public void TestMethod2() { Directory C = new Directory("C:", null); File CurrentFile = C; Directory Test = new Directory("test", C); C.file.Add(Test); Assert.IsTrue(CurrentFile.delete("test")); }
public void TestMethod2() { Directory C = new Directory("C:", null); File CurrentFile = C; Directory Test = new Directory("Test", C); C.file.Add(Test); CurrentFile = CurrentFile.cd("Test"); Assert.AreEqual(Test.name, CurrentFile.getName()); }
public void TestMethod2() { Directory C = new Directory("C:", null); File CurrentFile = C; Directory toto = new Directory("toto", C); C.file.Add(toto); CurrentFile.renameTo("toto", "titi"); Assert.AreEqual("titi", C.file[0].name); }
public void TestMethod4() { Directory C = new Directory("C:", null); File CurrentFile = C; Directory Test = new Directory("Test", C); C.file.Add(Test); CurrentFile = CurrentFile.cd("Test"); Assert.AreEqual(0, CurrentFile.ls().Count); }
static void Main(string[] args) { string command; string[] listCommand; bool stop = true; Directory C = new Directory ("C:", null); File CurrentFile = C; while (stop == true) { command = Console.ReadLine(); listCommand = command.Split(' '); if (listCommand[0] == "mkdir") Console.WriteLine(CurrentFile.mkdir(listCommand[1])); if (listCommand[0] == "create") Console.WriteLine(CurrentFile.createNewFile(listCommand[1])); if (listCommand[0] == "ls" && CurrentFile.ls() != null) { foreach (File found in CurrentFile.ls()) { Console.WriteLine(found.name + " " + found.GetType() + " " + found.rights); } } if (listCommand[0] == "file") if (CurrentFile.isFile() == true) Console.WriteLine("Vous êtes dans un fichier!"); else if (CurrentFile.isFile() == false) Console.WriteLine("Vous n'êtes pas dans un fichier!"); if (listCommand[0] == "directory") if (CurrentFile.isDirectory() == true) Console.WriteLine("Vous êtes dans un répertoire!"); else if (CurrentFile.isDirectory() == false) Console.WriteLine("Vous n'êtes pas dans un répertoire!"); if (listCommand[0] == "name") Console.WriteLine(CurrentFile.getName()); if (listCommand[0] == "cd") CurrentFile = CurrentFile.cd(listCommand[1]); if (listCommand[0] == "parent") CurrentFile=CurrentFile.getParent(); if (listCommand[0] == "path") Console.WriteLine("PATH : " + CurrentFile.getPath()); if (listCommand[0] == "rename" && listCommand[1] != null && listCommand[2] != null) Console.WriteLine(CurrentFile.renameTo(listCommand[1], listCommand[2])); if (listCommand[0] == "delete") Console.WriteLine(C.delete(listCommand[1])); //if (listCommand[0] == "root") // Console.WriteLine(C.root(listCommand[1])); //if (listCommand[0] == "chmod") // Console.WriteLine(C.chmod(listCommand[1])); //if (listCommand[0] == "search") // Console.WriteLine(CurrentFile.search(listCommand[1])); } }
public void TestMethod1() { Directory CurrentFile = new Directory("C:", null); Assert.IsFalse(CurrentFile.isFile()); }
public File(string name, Directory father) { this.name = name; this.father = father; rights = 4; }
public Directory(string name, Directory father) : base(name, father) { this.rights = 4; }
public void TestMethod1() { Directory C = new Directory("C:", null); File CurrentFile = C; Assert.AreEqual(C.name, CurrentFile.getName()); }
public void TestMethod1() { Directory C = new Directory("C:", null); File CurrentFile = C; Assert.IsTrue(CurrentFile.createNewFile("NewFile")); }
public void TestMethod1() { Directory C = new Directory("C:", null); File CurrentFile = C; Assert.IsTrue(CurrentFile.mkdir("NewDirectory")); }
public void TestMethod3() { Directory C = new Directory("C:", null); File CurrentFile = C; Assert.IsFalse(CurrentFile.delete("test")); }
public void TestMethod1() { Directory C = new Directory("C:", null); File CurrentFile = C; Assert.AreEqual(null, CurrentFile.getParent()); }