public virtual void ExpanderPeerExpandStateCollapsed()
        {
            Expander item = new Expander();
            ExpanderAutomationPeer  peer     = null;
            IExpandCollapseProvider provider = null;

            TestAsync(
                item,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.ExpandCollapse) as IExpandCollapseProvider,
                () => Assert.AreEqual(ExpandCollapseState.Collapsed, provider.ExpandCollapseState, "Unexpected ExpandCollapseState!"));
        }
        public virtual void ExpanderPeerSupportsExpandCollapse()
        {
            Expander item = new Expander();
            ExpanderAutomationPeer  peer     = null;
            IExpandCollapseProvider provider = null;

            TestAsync(
                item,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.ExpandCollapse) as IExpandCollapseProvider,
                () => Assert.IsNotNull(provider, "IExpandCollapseProvider peer should not be null!"));
        }
        public virtual void ExpanderPeerCollapseCollapsed()
        {
            Expander item = new Expander();
            ExpanderAutomationPeer  peer     = null;
            IExpandCollapseProvider provider = null;

            TestAsync(
                item,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.ExpandCollapse) as IExpandCollapseProvider,
                () => provider.Collapse(),
                () => Assert.IsFalse(item.IsExpanded, "Item should be collapsed!"));
        }
        public virtual void ExpanderPeerCollapseDisabled()
        {
            Expander item = new Expander {
                IsEnabled = false
            };
            ExpanderAutomationPeer  peer     = null;
            IExpandCollapseProvider provider = null;

            TestAsync(
                item,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.ExpandCollapse) as IExpandCollapseProvider,
                () => provider.Collapse());
        }
        public virtual void ExpanderPeerOnlySupportsExpandCollapse()
        {
            Expander item = new Expander();
            ExpanderAutomationPeer peer = null;

            TestAsync(
                item,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "ExpanderAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.ExpandCollapse), "ExpanderAutomationPeer should support the ExpandCollapse pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "ExpanderAutomationPeer should not support the Grid pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "ExpanderAutomationPeer should not support the GridItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "ExpanderAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "ExpanderAutomationPeer should not support the MultipleView pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "ExpanderAutomationPeer should not support the RangeValue pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Scroll), "ExpanderAutomationPeer should not support the Scroll pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "ExpanderAutomationPeer should not support the ScrollItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Selection), "ExpanderAutomationPeer should not support the Selection pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "ExpanderAutomationPeer should not support the Table pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "ExpanderAutomationPeer should not support the TableItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "ExpanderAutomationPeer should not support the Toggle pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "ExpanderAutomationPeer should not support the Transform pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Value), "ExpanderAutomationPeer should not support the Value pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "ExpanderAutomationPeer should not support the Window pattern!"));
        }