예제 #1
0
        public void NormalizeSeveralDirectories_CommonBaseDirectory()
        {
            var tree = new PathTree();
            var id1  = new object();

            var paths = new string[] {
                "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/4.5",
                "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089",
                "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089",
                "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Data/4.0.0.0__b77a5c561934e089",
                "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089"
            };

            foreach (var path in paths)
            {
                tree.AddNode(path, id1);
            }

            var folders = tree.Normalize(10).Select(node => (FilePath)node.GetPath().ToString());
            var set     = new HashSet <FilePath> (folders);

            foreach (var path in paths)
            {
                Assert.IsTrue(set.Contains(path), "Set: " + string.Join("\n", set));
            }
        }
예제 #2
0
        public void NormalizeSeveralDirectories_CommonBaseDirectory()
        {
            var tree = new PathTree();
            var id1  = new object();

            var paths = new string[] {
                MakePath("Library", "Frameworks", "Mono.framework", "Versions", "Current", "lib", "mono", "4.5"),
                MakePath("Library", "Frameworks", "Mono.framework", "Versions", "Current", "lib", "mono", "gac", "System", "4.0.0.0__b77a5c561934e089"),
                MakePath("Library", "Frameworks", "Mono.framework", "Versions", "Current", "lib", "mono", "gac", "System.Core", "4.0.0.0__b77a5c561934e089"),
                MakePath("Library", "Frameworks", "Mono.framework", "Versions", "Current", "lib", "mono", "gac", "System.Data", "4.0.0.0__b77a5c561934e089"),
                MakePath("Library", "Frameworks", "Mono.framework", "Versions", "Current", "lib", "mono", "gac", "System.Xml", "4.0.0.0__b77a5c561934e089"),
            };

            foreach (var path in paths)
            {
                tree.AddNode(path, id1);
            }

            var folders = tree.Normalize(10).Select(node => (FilePath)node.GetPath().ToString());
            var set     = new HashSet <FilePath> (folders);

            foreach (var path in paths)
            {
                Assert.IsTrue(set.Contains(path), "Set: " + string.Join("\n", set));
            }
        }
예제 #3
0
        public void NormalizeTwoDirectories_FirstIsChildOfSecondDirectoryAdded()
        {
            var tree = new PathTree();
            var id1  = new object();

            tree.AddNode("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mmp", id1);
            tree.AddNode("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib", id1);

            var folders = tree.Normalize(10).Select(node => (FilePath)node.GetPath().ToString());
            var set     = new HashSet <FilePath> (folders);

            Assert.IsTrue(set.Contains("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib"), "Set: " + string.Join("\n", set));
        }
예제 #4
0
        public void NormalizeTwoDirectories_FirstIsChildOfSecondDirectoryAdded()
        {
            var tree = new PathTree();
            var id1  = new object();

            var mmpPath = MakePath("Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "lib", "mmp");
            var libPath = MakePath("Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "lib");

            tree.AddNode(mmpPath, id1);
            tree.AddNode(libPath, id1);

            var folders = tree.Normalize(10).Select(node => (FilePath)node.GetPath().ToString());
            var set     = new HashSet <FilePath> (folders);

            Assert.IsTrue(set.Contains(libPath), "Set: " + string.Join("\n", set));
            Assert.IsFalse(set.Contains(mmpPath), "Set: " + string.Join("\n", set));
        }