Ejemplo n.º 1
0
        public void ShouldReturnIdOfFolderIfInSubFolderAsSecondSibling()
        {
            HierarchyHelper  hierarchyHelper = new HierarchyHelper();
            MockVsHierarchy2 mockHierarchy   = new MockVsHierarchy2();
            Node             subFolderNode   = new Node {
                Name = "subfolder"
            };
            Node folderNode = new Node {
                Name = "folder", FirstChild = subFolderNode
            };
            Node aSiblingNode = new Node {
                Name = "otherItem", NextSibling = folderNode
            };
            Node firstChildNode = new Node {
                Name = "yetanotherItem", NextSibling = aSiblingNode
            };
            Node rootNode = new Node(true)
            {
                FirstChild = firstChildNode
            };

            mockHierarchy.AddNode(rootNode);

            uint itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder\\subfolder");

            Assert.AreEqual(subFolderNode.ItemId, itemId);
        }
        public void ShouldReturnIdOfFolderIfIsFirstChild()
        {
            var hierarchyHelper = new HierarchyHelper();
            var mockHierarchy = new MockVsHierarchy2();
            Node folderNode = new Node() { Name = "folder" };
            Node rootNode = new Node(true) { FirstChild = folderNode };
            mockHierarchy.AddNode(rootNode);

            var itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder");

            Assert.AreEqual(folderNode.ItemId, itemId);
        }
        public void ShouldReturnIdOfFolderIfInSubFolder()
        {
            var hierarchyHelper = new HierarchyHelper();
            var mockHierarchy = new MockVsHierarchy2();
            Node subFolderNode = new Node() { Name = "subfolder" };
            Node folderNode = new Node() { Name = "folder", FirstChild = subFolderNode };
            Node firstChildNode = new Node() { Name = "otherItem", NextSibling = folderNode };
            Node rootNode = new Node(true) { FirstChild = firstChildNode };
            mockHierarchy.AddNode(rootNode);

            var itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder\\subfolder");

            Assert.AreEqual(subFolderNode.ItemId, itemId);
        }
Ejemplo n.º 4
0
        public void ShouldReturnIdOfFolderIfIsFirstChild()
        {
            HierarchyHelper  hierarchyHelper = new HierarchyHelper();
            MockVsHierarchy2 mockHierarchy   = new MockVsHierarchy2();
            Node             folderNode      = new Node {
                Name = "folder"
            };
            Node rootNode = new Node(true)
            {
                FirstChild = folderNode
            };

            mockHierarchy.AddNode(rootNode);

            uint itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder");

            Assert.AreEqual(folderNode.ItemId, itemId);
        }
Ejemplo n.º 5
0
        public void ShouldReturnNilIfElementDoesntExists()
        {
            HierarchyHelper  hierarchyHelper = new HierarchyHelper();
            MockVsHierarchy2 mockHierarchy   = new MockVsHierarchy2();
            Node             firstChildNode  = new Node {
                Name = "anotherItem"
            };
            Node rootNode = new Node(true)
            {
                FirstChild = firstChildNode
            };

            mockHierarchy.AddNode(rootNode);

            uint itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder\\subfolder");

            Assert.AreEqual(VSConstants.VSITEMID_NIL, itemId);
        }
        public void ShouldReturnNilIfElementDoesntExists()
        {
            var hierarchyHelper = new HierarchyHelper();
            var mockHierarchy = new MockVsHierarchy2();
            Node firstChildNode = new Node() { Name = "anotherItem" };
            Node rootNode = new Node(true) { FirstChild = firstChildNode };
            mockHierarchy.AddNode(rootNode);

            var itemId = hierarchyHelper.GetItemId(mockHierarchy, "folder\\subfolder");

            Assert.AreEqual(VSConstants.VSITEMID_NIL, itemId);
        }