Пример #1
0
 public void RenameToByFile()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(7);
     dossier.createNewFile("hui");
     Assert.IsFalse(dossier.ListFile[0].renameTo("toto", "hui"));
 }
Пример #2
0
 public void LsByFile()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(7);
     dossier.createNewFile("hui");
     Assert.AreEqual(dossier.ListFile[0].ls(), null);
 }
Пример #3
0
 public void TestCdDirectory()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.mkdir("directory");
     Assert.AreEqual(dossier.cd("directory"), dossier.files[0]);
 }
Пример #4
0
 public void CreateNewFileByDirectoryWithExistName()
 {
     Directory dossier2 = new Directory("dossier", null);
     dossier2.chmod(7);
     dossier2.createNewFile("hui");
     Assert.IsFalse(dossier2.createNewFile("hui"));
 }
Пример #5
0
 public void CdByDirectoryInFileNoExist()
 {
     Directory dossier6 = new Directory("dossier", null);
     dossier6.chmod(7);
     dossier6.createNewFile("hui");
     Assert.AreEqual(dossier6.cd("rfd"), null);
 }
Пример #6
0
 public void TestCdFile()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.createNewFile("file");
     Assert.AreEqual(dossier.cd("file"), dossier.files[0]);
 }
Пример #7
0
 public void DeleteByDirectoryNameNoExist()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.mkdir("hui");
     dossier.chmod(7);
     Assert.IsFalse(dossier.delete("huit"));
 }
Пример #8
0
 public void CdByDirectoryInFile()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(7);
     dossier.createNewFile("hui");
     Assert.AreEqual(dossier.cd("hui"), dossier.ListFile[0]);
 }
Пример #9
0
 public void MkdirByDirectoryAddList()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(7);
     dossier.mkdir("hui");
     Assert.AreEqual(dossier.ListFile.Count, 1);
 }
Пример #10
0
 public void SearchbyFileNoExist()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.mkdir("hui");
     dossier.chmod(7);
     Assert.AreEqual(dossier.search("cuicui").Count, 0);
 }
Пример #11
0
 public void CreateNewFileByDirectoryAddList()
 {
     Directory dossier4 = new Directory("dossier", null);
     dossier4.chmod(7);
     dossier4.createNewFile("hui");
     Assert.AreEqual(dossier4.ListFile.Count, 1);
 }
Пример #12
0
 public void TestCreateFile()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.createNewFile("file");
     Assert.AreEqual(dossier.files[0].Nom, "file");
     Assert.AreEqual(dossier.files.Count, 1);
 }
Пример #13
0
 public void DeleteByDirectoryDeleteList()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.mkdir("hui");
     dossier.chmod(7);
     dossier.delete("hui");
     Assert.AreEqual(dossier.ListFile.Count, 0);
 }
Пример #14
0
        public void DeleteByDirectory()
        {
            Directory dossier = new Directory("dossier", null);
            dossier.chmod(7);
            dossier.mkdir("hui");

            Assert.IsTrue(dossier.delete("hui"));
        }
Пример #15
0
 public void RenameToByDirectory()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(7);
     dossier.createNewFile("hui");
     dossier.renameTo("hui", "toto");
     Assert.AreEqual("toto", dossier.ListFile[0].Name);
 }
Пример #16
0
 public File(string Nom, Directory parent)
 {
     this.Nom = Nom;
     parent.Fichiers.Add(this);
     this.parent = parent;
     string pathEntier = parent.path + "/" + Nom;
     path = pathEntier;
     permission = 4;
 }
Пример #17
0
 public void LsByDirectoryNoPermit()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod(1);
     dossier.createNewFile("hui");
     dossier.createNewFile("hui");
     dossier.createNewFile("hui");
     dossier.createNewFile("hui");
     Assert.AreEqual(dossier.ls(), null);
 }
Пример #18
0
 public File(Directory parent,string name)
 {
     this.parent = parent;
     this.name = name;
     this.permission = 4;
     isRoot = false;
     if(this.parent.GetType() != null){
         this.parent.childList.Add(this);
         var fullPath = "";
         fullPath = this.parent.path + "/" + name;
         path = fullPath;
     }
 }
Пример #19
0
        public void GetPathByFile()
        {
            Directory dossier = new Directory("C:", null);

            dossier.chmod(7);
            dossier.mkdir("hui");
            File FileCurrent = dossier;
            FileCurrent = dossier.cd("hui");
            FileCurrent.chmod(7);
            FileCurrent.mkdir("toto");
            FileCurrent = FileCurrent.cd("toto");
            FileCurrent.chmod(7);
            Assert.AreEqual(FileCurrent.getPath(), "C:/hui/toto");
        }
Пример #20
0
        public void SearchbyFile()
        {
            Directory dossier = new Directory("dossier", null);
            File fileCurrent = dossier;
            fileCurrent.chmod(7);

            fileCurrent.mkdir("hui");
            fileCurrent = fileCurrent.cd("hui");
            fileCurrent.chmod(7);
            fileCurrent.mkdir("hui");
            fileCurrent = fileCurrent.cd("hui");
            fileCurrent.chmod(7);
            fileCurrent.mkdir("hui");
            fileCurrent = fileCurrent.cd("hui");
            fileCurrent.chmod(1);

            Assert.AreEqual(dossier.search("hui").Count, 3);
        }
Пример #21
0
        static Directory WalkThePathLookingForNu(Directory direc, NuConventions conventions)
        {
            Directory result = null;

            if (!direc.IsRoot())
            {
                Directory bro = direc.GetChildDirectory(conventions.ProjectDirectoryName);
                if (bro.Exists())
                {
                    _logger.Debug(x => x.Write("Found the nu folder: {0}", bro.Name));

                    return bro;
                }
                if (direc.HasParentDir)
                {
                    result = WalkThePathLookingForNu(direc.Parent, conventions);
                }
            }

            return result;
        }
Пример #22
0
 public Directory(string Name, Directory Parent)
     : base(Name, Parent)
 {
     this.Permission = 4;
 }
Пример #23
0
 static void Main(string[] args)
 {
     //Oui je sais c'est pas C: mais j'm'embrouille moins comme ça
     Directory C = new Directory("C:");
     File Actuel = (Directory)C;
     commande(Actuel);
 }
Пример #24
0
 public void TestDeleteFalse()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.createNewFile("file");
     Assert.IsFalse(dossier.delete("Fichier"));
 }
Пример #25
0
 public void TestCreateFiledansDirectorySansDroit()
 {
     Directory dossier = new Directory("dossier", null);
     Assert.IsFalse(dossier.createNewFile("file"));
 }
Пример #26
0
 public void TestCreateFiledansDirectory()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     Assert.IsTrue(dossier.createNewFile("file"));
 }
Пример #27
0
 public void TestChmod7()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     Assert.AreEqual(dossier.Permission, 7);
 }
Пример #28
0
 public void TestSearchFileExist()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.createNewFile("file");
     Assert.AreEqual(dossier.search("Fichier").Count, 0);
 }
Пример #29
0
        public void TestSearchFile()
        {
            Directory dossier = new Directory("dossier", null);
            File file = dossier;
            file.chmod("7");
            file.mkdir("Directory");
            file = file.cd("Directory");
            file.chmod("7");
            file.mkdir("Directory");
            file = file.cd("Directory");
            file.chmod("7");
            file.createNewFile("Directory");

            Assert.AreEqual(dossier.search("Directory").Count, 3);
        }
Пример #30
0
 public void TestRenameTo_True()
 {
     Directory dossier = new Directory("dossier", null);
     dossier.chmod("7");
     dossier.createNewFile("file");
     dossier.mkdir("Directory");
     Assert.IsTrue(dossier.renameTo("file", "Fichier"));
 }