示例#1
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));
        }
示例#2
0
        public void CreateEmptyTree()
        {
            var tree = new PathTree();
            var node = tree.rootNode;

            if (!Platform.IsWindows)
            {
                node = node.FirstChild;
                Assert.AreEqual("", node.GetPath().ToString());

                Assert.AreSame(tree.pathRoot, node);
            }

            Assert.IsNull(node.FirstChild);
            Assert.IsNull(node.LastChild);
            Assert.IsNull(node.Next);
        }
示例#3
0
        public void CreateTreeAndRegisterRoot()
        {
            var tree = new PathTree();

            tree.AddNode(prefix, id);
            tree.RemoveNode(prefix, id);

            var node = tree.FindNode(prefix);

            if (Platform.IsWindows)
            {
                Assert.IsNull(node);
            }
            else
            {
                Assert.IsNotNull(node);
                Assert.AreEqual(false, node.IsLive);
            }
        }