Пример #1
0
 public void RootSize()
 {
     DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
     DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
     double size = dirTree.CalculateSizeOfTree();
     Assert.AreEqual(5, (int)size);
 }
Пример #2
0
 public void FolderSize()
 {
     DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
     DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
     double size = dirTree.CalculateSizeOfFolder("4");
     Assert.IsTrue(size >= 2d && size < 2.1d);
 }
Пример #3
0
 public void RootFilesFound()
 {
     DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
     DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
     Folder folder = dirTree.RootFolder;
     Assert.AreEqual(3, folder.Files.Count);
 }
Пример #4
0
 public void CorrectRootFolder()
 {
     DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
     DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
     Folder folder = dirTree.RootFolder;
     Assert.AreEqual("TestDirectory", folder.Name);
 }
Пример #5
0
        public void SearchedFolderFound()
        {
            DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
            DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
            Folder folder = dirTree.FindFolder("1");

            Assert.AreEqual("1", folder.Name);

            Assert.AreEqual(1, folder.Files.Count);

            Assert.AreEqual(2, folder.Folders.Count);
        }
Пример #6
0
        public void RootFoldersFound()
        {
            DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
            DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
            Folder folder = dirTree.RootFolder;

            List<Folder> folders = folder.Folders;
            Assert.AreEqual(4, folders.Count);

            for (int i = 0; i < folders.Count; i++)
            {
                Assert.AreEqual((i + 1).ToString(), folders[i].Name);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Tree is building, please wait for few seconds...");
            DirectoryTree dirTree = new DirectoryTree("C:\\Windows");

            Console.WriteLine("Done.");

            Console.WriteLine("\nTree size: ");
            double sizeInMB = dirTree.CalculateSizeOfTree();
            Console.WriteLine("{0} megabytes", sizeInMB);
            Console.WriteLine("{0} or gigabytes", sizeInMB / 1024);

            //in windows 8 AppCompat exists, you can try any other folder in Windows directory
            Console.WriteLine("\nCalculate size of tree folder and subfolders: ");
            sizeInMB = dirTree.CalculateSizeOfFolder("AppCompat");
            Console.WriteLine("{0} megabytes", sizeInMB);
            Console.WriteLine("{0} or gigabytes", sizeInMB / 1024);

        }
Пример #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Tree is building, please wait for few seconds...");
            DirectoryTree dirTree = new DirectoryTree("C:\\Windows");

            Console.WriteLine("Done.");

            Console.WriteLine("\nTree size: ");
            double sizeInMB = dirTree.CalculateSizeOfTree();

            Console.WriteLine("{0} megabytes", sizeInMB);
            Console.WriteLine("{0} or gigabytes", sizeInMB / 1024);

            //in windows 8 AppCompat exists, you can try any other folder in Windows directory
            Console.WriteLine("\nCalculate size of tree folder and subfolders: ");
            sizeInMB = dirTree.CalculateSizeOfFolder("AppCompat");
            Console.WriteLine("{0} megabytes", sizeInMB);
            Console.WriteLine("{0} or gigabytes", sizeInMB / 1024);
        }
Пример #9
0
 public void CreateTree()
 {
     DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory");
     DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory");
     Assert.IsNotNull(dirTree);
 }