示例#1
0
        public void DetectsFaultyPeers()
        {
            TestInterface(PatternInterface.Annotation);
            TestInterface(PatternInterface.CustomNavigation);
            TestInterface(PatternInterface.Drag);
            TestInterface(PatternInterface.DropTarget);
            TestInterface(PatternInterface.Grid);
            TestInterface(PatternInterface.Invoke);
            TestInterface(PatternInterface.MultipleView);
            TestInterface(PatternInterface.RangeValue);
            TestInterface(PatternInterface.Selection);
            TestInterface(PatternInterface.SelectionItem);

            void TestInterface(PatternInterface pattern)
            {
                var element = new Button();
                var peer    = new PatternInterfacePeer(element, AutomationControlType.Custom);

                peer.ImplementedInterfaces.Add(pattern);

                var rule = new PatternInterfaceImplementedRule();

                Assert.IsFalse(rule.IsValid(element, peer));
            }
        }
示例#2
0
        public void FaultyControlFails()
        {
            var button = new Button();
            var peer   = new PatternInterfacePeer(button, AutomationControlType.Button);

            var rule = new TypeButtonIsInvokeOrToggleRule();

            Assert.IsFalse(rule.IsValid(button, peer));
        }