public virtual void AccordionPeerOnlySupportsSelection()
        {
            Accordion view = new Accordion();
            AccordionAutomationPeer peer = null;

            TestAsync(
                view,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(view) as AccordionAutomationPeer,
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "AccordionAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "AccordionAutomationPeer should not support the ExpandCollapse pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "AccordionAutomationPeer should not support the Grid pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "AccordionAutomationPeer should not support the GridItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "AccordionAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "AccordionAutomationPeer should not support the MultipleView pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "AccordionAutomationPeer should not support the RangeValue pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "AccordionAutomationPeer should not support the ScrollItem pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Selection), "AccordionAutomationPeer should support the Selection pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.SelectionItem), "AccordionAutomationPeer should not support the SelectionItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "AccordionAutomationPeer should not support the Table pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "AccordionAutomationPeer should not support the TableItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "AccordionAutomationPeer should not support the Toggle pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "AccordionAutomationPeer should not support the Transform pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Value), "AccordionAutomationPeer should not support the Value pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "AccordionAutomationPeer should not support the Window pattern!"));
        }
        public virtual void AccordionPeerGetNoItems()
        {
            Accordion acc = new Accordion();
            AccordionAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as AccordionAutomationPeer,
                () => Assert.IsNull(peer.GetChildren(), "There should be no children when the Accordion does not have items!"));
        }
        public virtual void AccordionAutomationPeerTypeAndClass()
        {
            Accordion acc = new Accordion();
            AccordionAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as AccordionAutomationPeer,
                () => Assert.AreEqual(AutomationControlType.List, peer.GetAutomationControlType(), "Unexpected AutomationControlType!"),
                () => Assert.AreEqual("Accordion", peer.GetClassName(), "Unexpected ClassType!"));
        }
        public virtual void AccordionCreatesAutomationPeer()
        {
            Accordion acc = new Accordion();
            AccordionAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as AccordionAutomationPeer,
                () => Assert.IsNotNull(peer, "Accordion peer should not be null!"),
                () => Assert.AreEqual(acc, peer.Owner, "Accordion should be owner of the peer!"));
        }
        public virtual void AccordionPeerSupportsSelection()
        {
            Accordion acc = new Accordion();
            AccordionAutomationPeer peer     = null;
            ISelectionProvider      provider = null;

            TestAsync(
                acc,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as AccordionAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.Selection) as ISelectionProvider,
                () => Assert.IsNotNull(provider, "ISelectionProvider peer should not be null!"));
        }
        public virtual void AccordionPeerGetWithItems()
        {
            Accordion view = new Accordion {
                ItemsSource = new[] { 1, 2, 3 }
            };
            AccordionAutomationPeer peer  = null;
            List <AutomationPeer>   items = null;

            TestAsync(
                view,
                () => peer  = FrameworkElementAutomationPeer.CreatePeerForElement(view) as AccordionAutomationPeer,
                () => items = peer.GetChildren(),
                () => Assert.AreEqual(3, items.Count, "Unexpected number of child peers!"),
                () => Assert.IsInstanceOfType(items[0], typeof(AccordionItemAutomationPeer), "Child peer is not an AccordionItemAutomationPeer!"));
        }