private HResult ExpandItem(IVsUIHierarchy uiHierarchy, HierarchyId id, EXPANDFLAGS flags)
        {
            Requires.NotNull(uiHierarchy, nameof(uiHierarchy));
            Requires.Argument(!(id.IsNilOrEmpty || id.IsSelection), nameof(id), "id must not be nil, empty or represent a selection.");

            return(Invoke(window => window.ExpandItem(uiHierarchy, id, flags)));
        }
        public void Implicit_ToUInt32_ReturnsId(uint id)
        {
            var hierarchyId = new HierarchyId(id);

            uint result = hierarchyId;

            Assert.Equal(id, result);
        }
        public void IsEmpty_WhenIdIsNotNil_ReturnsFalse(uint id)
        {
            var hierarchyId = new HierarchyId(id);

            Assert.False(hierarchyId.IsNil);
        }
        public void IsNil_WhenIdIsNil_ReturnsTrue()
        {
            var hierarchyId = new HierarchyId((uint)VSConstants.VSITEMID.Nil);

            Assert.True(hierarchyId.IsNil);
        }
        public void IsEmpty_WhenIdIsEmpty_ReturnsTrue()
        {
            var hierarchyId = new HierarchyId(0);

            Assert.True(hierarchyId.IsEmpty);
        }
        public void IsSelection_WhenIdIsNotSelection_ReturnsFalse(uint id)
        {
            var hierarchyId = new HierarchyId(id);

            Assert.False(hierarchyId.IsSelection);
        }
        public void IsSelection_WhenIdIsSelection_ReturnsTrue()
        {
            var hierarchyId = new HierarchyId((uint)VSConstants.VSITEMID.Selection);

            Assert.True(hierarchyId.IsSelection);
        }
        public void IsRoot_WhenIdIsNotRoot_ReturnsFalse(uint id)
        {
            var hierarchyId = new HierarchyId(id);

            Assert.False(hierarchyId.IsRoot);
        }
        public void Constructor_ValueAsId_SetsId(uint id)
        {
            var hierarchyId = new HierarchyId(id);

            Assert.Equal(id, hierarchyId.Id);
        }
        public void Implicit_ToHierarchyId_SetsId(uint id)
        {
            HierarchyId hierarchyId = id;

            Assert.Equal(id, hierarchyId.Id);
        }
        public void Constructor1_ReturnsEmpty()
        {
            var hierarchyId = new HierarchyId();

            Assert.True(hierarchyId.IsEmpty);
        }
 /// <summary>
 ///     Selects the specified node.
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="uiHierarchy"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><paramref name="id"/> is nil, empty or represents a selection.</exception>
 /// <exception cref="InvalidOperationException">This method was not accessed from the UI thread.</exception>
 /// <exception cref="InvalidOperationException"><see cref="IsAvailable"/> is <see langword="false"/>.</exception>
 public HResult Select(IVsUIHierarchy uiHierarchy, HierarchyId id)
 {
     return(ExpandItem(uiHierarchy, id, EXPANDFLAGS.EXPF_SelectItem));
 }