public void ClearsStateCorrectly()
        {
            var mainButton = new Button();

            AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main);
            var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton);
            var rule     = new LandmarkTypeMainOnceRule();

            Assert.IsTrue(rule.IsValid(mainButton, mainPeer));
            Assert.IsFalse(rule.IsValid(mainButton, mainPeer));

            rule.ResetState();
            Assert.IsTrue(rule.IsValid(mainButton, mainPeer));
        }
        public void VerifyTreeComplyBehavior()
        {
            var noMainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(new Button());
            var mainButton = new Button();

            AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main);
            var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton);
            var rule     = new LandmarkTypeMainOnceRule();

            Assert.IsTrue(rule.IsValid(null, noMainPeer));

            Assert.IsTrue(rule.IsValid(null, mainPeer));

            for (int i = 0; i < 10; i++)
            {
                Assert.IsTrue(rule.IsValid(null, noMainPeer));
            }
        }
        public void VerifyFailingTreeFails()
        {
            var noMainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(new Button());
            var mainButton = new Button();

            AutomationProperties.SetLandmarkType(mainButton, AutomationLandmarkType.Main);
            var mainPeer = FrameworkElementAutomationPeer.CreatePeerForElement(mainButton);
            var rule     = new LandmarkTypeMainOnceRule();

            Assert.IsTrue(rule.IsValid(null, noMainPeer));

            Assert.IsTrue(rule.IsValid(null, mainPeer));

            Assert.IsTrue(rule.IsValid(null, noMainPeer));

            Assert.IsFalse(rule.IsValid(null, mainPeer));

            Assert.IsTrue(rule.IsValid(null, noMainPeer));

            var stackPanel = new StackPanel();

            AutomationProperties.SetLandmarkType(stackPanel, AutomationLandmarkType.Main);
        }