Exemplo n.º 1
0
 public void TestMethod1()
 {
     List<File> file = new List<File>();
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.AreEqual(null, CurrentFile.ls());
 }
Exemplo n.º 2
0
 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());
 }
Exemplo n.º 3
0
 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"));
 }
Exemplo n.º 4
0
 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"));
 }
Exemplo n.º 5
0
 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());
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
        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]));
            }
        }
Exemplo n.º 9
0
 public void TestMethod1()
 {
     Directory CurrentFile = new Directory("C:", null);
     Assert.IsFalse(CurrentFile.isFile());
 }
Exemplo n.º 10
0
 public File(string name, Directory father)
 {
     this.name = name;
     this.father = father;
     rights = 4;
 }
Exemplo n.º 11
0
 public Directory(string name, Directory father)
     : base(name, father)
 {
     this.rights = 4;
 }
Exemplo n.º 12
0
 public void TestMethod1()
 {
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.AreEqual(C.name, CurrentFile.getName());
 }
Exemplo n.º 13
0
 public void TestMethod1()
 {
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.IsTrue(CurrentFile.createNewFile("NewFile"));
 }
Exemplo n.º 14
0
 public void TestMethod1()
 {
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.IsTrue(CurrentFile.mkdir("NewDirectory"));
 }
Exemplo n.º 15
0
 public void TestMethod3()
 {
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.IsFalse(CurrentFile.delete("test"));
 }
Exemplo n.º 16
0
 public void TestMethod1()
 {
     Directory C = new Directory("C:", null);
     File CurrentFile = C;
     Assert.AreEqual(null, CurrentFile.getParent());
 }