public void RootSize() { DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory"); DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory"); double size = dirTree.CalculateSizeOfTree(); Assert.AreEqual(5, (int)size); }
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); }
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); }
public void CorrectRootFolder() { DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory"); DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory"); Folder folder = dirTree.RootFolder; Assert.AreEqual("TestDirectory", folder.Name); }
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); }
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); }
public void CreateTree() { DirectoryInfo dir = Directory.GetParent("..\\..\\TestDirectory"); DirectoryTree dirTree = new DirectoryTree(dir.FullName + "\\TestDirectory"); Assert.IsNotNull(dirTree); }