Beispiel #1
0
        public static void Simple()
        {
            var o = new Options();

            o.TrySetFromSwitch("s");

            var paths = new List <Path> {
                new Path("M  asdfsdf.txt", o),
                new Path("R  dfgdfg.txt -> ssdfds/dfgdfg.txt", o),
                new Path("A  \"ssdfds/ssdfds 2/dfgdfg.txt\"", o),
                new Path("A  \"ssdfds/ssdfds 2/fdsgfdgdfg.txt\"", o),
                new Path("A  \"ssdfds/ssdfds 2/ssdfds 3/dfgdfg.txt\"", o),
                new Path("A  \"ssdfds/ssdfds 2/ssdfds 3/fdsgfdgdfg.txt\"", o),
            };
            var root   = new Node.Folder.Root(paths);
            var result = new NodePrinter(root, o);

            var correct = @" R  dfgdfg.txt -> ssdfds/dfgdfg.txt
 M_ asdfsdf.txt
 ┬ ssdfds
 └─┬ ssdfds 2
   │  A_ dfgdfg.txt
   │  A_ fdsgfdgdfg.txt
   └── ssdfds 3
        A_ dfgdfg.txt
        A_ fdsgfdgdfg.txt
".Replace("\r\n", "\n");

            Assert.AreEqual(correct, result.ToString());
        }
Beispiel #2
0
        public static void Simple2()
        {
            var o     = new Options();
            var paths = new List <Path> {
                new Path("folder_1/folder_1_1/file_1.txt", o),
                new Path("folder_1/folder_1_1/file_2.txt", o),
                new Path("folder_1/folder_1_2/file_2.txt", o),
                new Path("folder_2/folder_2_1/file_3.txt", o),
                new Path("folder_2/folder_2_1/file_4.txt", o),
                new Path("folder_1/folder_1_2/file_5.txt", o),
                new Path("folder_3/folder_3_1", o),
                new Path("folder_3/folder_3_1/file_6.txt", o),
            };
            var root   = new Node.Folder.Root(paths);
            var result = new NodePrinter(root, o);

            var correct = @" ┬ folder_1
 ├── folder_1_1
 │    file_1.txt
 │    file_2.txt
 └── folder_1_2
      file_2.txt
      file_5.txt
 ┬ folder_2
 └── folder_2_1
      file_3.txt
      file_4.txt
 ┬ folder_3
 └── folder_3_1
      file_6.txt
".Replace("\r\n", "\n");

            Assert.AreEqual(correct, result.ToString());
        }
Beispiel #3
0
        public static void Simple()
        {
            var o     = new Options();
            var paths = new List <Path>();

            paths.Add(new Path(@"file1", o));
            paths.Add(new Path(@"folder/file2", o));

            var root   = new Node.Folder.Root(paths);
            var result = new NodePrinter(root, o);

            var correct = @" file1
 + folder
    file2
".Replace("\r\n", "\n");

            Assert.AreEqual(correct, result.ToString());
        }
Beispiel #4
0
        public static void Lite()
        {
            var o = new Options();

            o.TrySetFromSwitch("s");
            o.TrySetFromSwitch("i");

            var paths = new List <Path>();

            paths.Add(new Path(@"M F1.txt", o));
            paths.Add(new Path(@"M Folder\F2.txt", o));
            paths.Add(new Path(@"! F3.txt", o));
            paths.Add(new Path(@"? Folder\F33.txt", o));
            paths.Add(new Path(@"? Folder\Folder 1\F2.txt", o));
            paths.Add(new Path(@"? Folder\Folder 1\F33.txt", o));
            paths.Add(new Path(@"? Folder\Folder 1\Folder 2\F2.txt", o));
            paths.Add(new Path(@"? Folder\Folder 1\Folder 2\F33.txt", o));

            var root   = new Node.Folder.Root(paths);
            var result = new NodePrinter(root, o);

            var correct = @" M F1.txt
 ! F3.txt
 > Folder
   M F2.txt
   ? F33.txt
   > Folder 1
     ? F2.txt
     ? F33.txt
     > Folder 2
       ? F2.txt
       ? F33.txt
".Replace("\r\n", "\n");

            Assert.AreEqual(correct, result.ToString());
        }
Beispiel #5
0
        public static void Complex()
        {
            var o     = new Options();
            var paths = new List <Path>();

            paths.Add(new Path(@"C:\WINDOWS\AppPatch\MUI\040C.file", o));
            paths.Add(new Path(@"C:\foo.file", o));
            paths.Add(new Path(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MUI", o));
            paths.Add(new Path(@"C:\WINDOWS\addins.file", o));
            paths.Add(new Path(@"C:\WINDOWS\AppPatch\MUI", o));
            paths.Add(new Path(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MUI\0409.file", o));
            paths.Add(new Path(@"C:\WINDOWS\Microsoft.NET\Framework2\v2.0.50727\MUI\0409.file", o));

            var root   = new Node.Folder.Root(paths);
            var result = new NodePrinter(root, o);

            var correct = @" ┬ C:
 │  foo.file
 └─┬ WINDOWS
   │  addins.file
   ├─┬ AppPatch
   │ └── MUI
   │      040C.file
   └─┬ Microsoft.NET
     ├─┬ Framework
     │ └─┬ v2.0.50727
     │   └── MUI
     │        0409.file
     └─┬ Framework2
       └─┬ v2.0.50727
         └── MUI
              0409.file
".Replace("\r\n", "\n");

            Assert.AreEqual(correct, result.ToString());
        }
Beispiel #6
0
        public static void Simple()
        {
            Options o = new Options();

            List <Path> paths = new List <Path> {
                new Path("folder_1/folder_1_1/file_1.txt", o),
                new Path("folder_1/folder_1_2/file_2.txt", o),
                new Path("folder_2/folder_2_1/file_3.txt", o),
                new Path("folder_2/folder_2_1/file_4.txt", o),
                new Path("folder_1/folder_1_2/file_5.txt", o),
                new Path("folder_3/folder_3_1", o),
                new Path("folder_3/folder_3_1/file_6.txt", o),
            };

            var root = new Node.Folder.Root(paths).value;

            Assert.AreEqual("", root.name);
            Assert.AreEqual(3, root.folderChildren.Count);
            Assert.AreEqual(0, root.fileChildren.Count);

            var folder_1 = root.folderChildren[0];

            Assert.AreEqual("folder_1", folder_1.name);
            Assert.AreEqual(2, folder_1.folderChildren.Count);
            Assert.AreEqual(0, folder_1.fileChildren.Count);

            var folder_2 = root.folderChildren[1];

            Assert.AreEqual("folder_2", folder_2.name);
            Assert.AreEqual(1, folder_2.folderChildren.Count);
            Assert.AreEqual(0, folder_2.fileChildren.Count);

            var folder_3 = root.folderChildren[2];

            Assert.AreEqual("folder_3", folder_3.name);
            Assert.AreEqual(1, folder_3.folderChildren.Count);
            Assert.AreEqual(0, folder_3.fileChildren.Count);

            var folder_1_1 = folder_1.folderChildren[0];

            Assert.AreEqual("folder_1_1", folder_1_1.name);
            Assert.AreEqual(0, folder_1_1.folderChildren.Count);
            Assert.AreEqual(1, folder_1_1.fileChildren.Count);

            var file_1 = folder_1_1.fileChildren[0];

            Assert.AreEqual("file_1.txt", file_1.name);

            var folder_1_2 = folder_1.folderChildren[1];

            Assert.AreEqual("folder_1_2", folder_1_2.name);
            Assert.AreEqual(0, folder_1_2.folderChildren.Count);
            Assert.AreEqual(2, folder_1_2.fileChildren.Count);

            var file_2 = folder_1_2.fileChildren[0];

            Assert.AreEqual("file_2.txt", file_2.name);

            var file_5 = folder_1_2.fileChildren[1];

            Assert.AreEqual("file_5.txt", file_5.name);

            var folder_2_1 = folder_2.folderChildren[0];

            Assert.AreEqual("folder_2_1", folder_2_1.name);
            Assert.AreEqual(0, folder_2_1.folderChildren.Count);
            Assert.AreEqual(2, folder_2_1.fileChildren.Count);

            var file_3 = folder_2_1.fileChildren[0];

            Assert.AreEqual("file_3.txt", file_3.name);

            var file_4 = folder_2_1.fileChildren[1];

            Assert.AreEqual("file_4.txt", file_4.name);

            var folder_3_1 = folder_3.folderChildren[0];

            Assert.AreEqual("folder_3_1", folder_3_1.name);
            Assert.AreEqual(0, folder_3_1.folderChildren.Count);
            Assert.AreEqual(1, folder_3_1.fileChildren.Count);

            var file_6 = folder_3_1.fileChildren[0];

            Assert.AreEqual("file_6.txt", file_6.name);
        }