コード例 #1
0
        public void VerifyNoSelectionPeerPasses()
        {
            var button = new Button();
            var peer   = FrameworkElementAutomationPeer.CreatePeerForElement(button);

            var rule = new SingleSelectionRule();

            Assert.IsTrue(rule.IsValid(button, peer));
        }
コード例 #2
0
        public void VerifyMultiSelectionIgnored()
        {
            var button = new Button();
            var peer   = new SelectionPeer(button, 2)
            {
                CanSelectMultiple = true
            };

            var rule = new SingleSelectionRule();

            Assert.IsTrue(rule.IsValid(button, peer));
        }
コード例 #3
0
        public void VerifySelectionCountCorrectlyClassified()
        {
            VerifyCount(0, true);
            VerifyCount(1, true);
            VerifyCount(2, false);
            VerifyCount(3, false);

            void VerifyCount(int count, bool shouldPass)
            {
                var button = new Button();
                var peer   = new SelectionPeer(button, count);

                var rule = new SingleSelectionRule();

                Assert.AreEqual(shouldPass, rule.IsValid(button, peer));
            }
        }