예제 #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);
 }