Пример #1
0
        public virtual void RatingPeerOnlySupportsSelectionAndValue()
        {
            Rating view = new Rating();
            RatingAutomationPeer peer = null;

            TestAsync(
                view,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(view) as RatingAutomationPeer,
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "RatingAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "RatingAutomationPeer should not support the ExpandCollapse pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "RatingAutomationPeer should not support the Grid pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "RatingAutomationPeer should not support the GridItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "RatingAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "RatingAutomationPeer should not support the MultipleView pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "RatingAutomationPeer should not support the RangeValue pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "RatingAutomationPeer should not support the ScrollItem pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Selection), "RatingAutomationPeer should support the Selection pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.SelectionItem), "RatingAutomationPeer should not support the SelectionItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "RatingAutomationPeer should not support the Table pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "RatingAutomationPeer should not support the TableItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "RatingAutomationPeer should not support the Toggle pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "RatingAutomationPeer should not support the Transform pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Value), "RatingAutomationPeer should support the Value pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "RatingAutomationPeer should not support the Window pattern!"));
        }
Пример #2
0
        public virtual void RatingCreatesAutomationPeer()
        {
            Rating acc = new Rating();
            RatingAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as RatingAutomationPeer,
                () => Assert.IsNotNull(peer, "Rating peer should not be null!"),
                () => Assert.AreEqual(acc, peer.Owner, "Rating should be owner of the peer!"));
        }
Пример #3
0
        public virtual void RatingPeerSupportsSelection()
        {
            Rating acc = new Rating();
            RatingAutomationPeer peer     = null;
            ISelectionProvider   provider = null;

            TestAsync(
                acc,
                () => peer     = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as RatingAutomationPeer,
                () => provider = peer.GetPattern(PatternInterface.Selection) as ISelectionProvider,
                () => Assert.IsNotNull(provider, "ISelectionProvider peer should not be null!"));
        }
Пример #4
0
        public virtual void RatingPeerGetNoItems()
        {
            Rating acc = new Rating();

            acc.ItemsSource = null;
            RatingAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as RatingAutomationPeer,
                () => Assert.IsNull(peer.GetChildren(), "There should be no children when the Rating does not have items!"));
        }
Пример #5
0
        public virtual void RatingAutomationPeerTypeAndClass()
        {
            Rating acc = new Rating();
            RatingAutomationPeer peer = null;

            TestAsync(
                acc,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(acc) as RatingAutomationPeer,
                () =>
            {
                AutomationControlType controlType = peer.GetAutomationControlType();

                Assert.AreEqual(controlType, AutomationControlType.Slider, "Unexpected AutomationControlType!");
            });
        }
Пример #6
0
        public virtual void RatingPeerGetWithItems()
        {
            Rating view = new Rating();

            view.ItemCount = 3;
            RatingAutomationPeer  peer  = null;
            List <AutomationPeer> items = null;

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