Esempio n. 1
0
        public void WpfDemoControlGetAllPropertiesTest()
        {
            Assert.IsTrue(_fixture.SelectItem("Caption:Data Grid"), "Select 'Data Grid' tab");
            var control = _fixture.GetControl("id:DataGrid1");

            Assert.AreEqual("DataGrid1", control.Property("30011"), "Find property by constant value (UIA_AutomationIdPropertyId)");
            Assert.AreEqual("DataGrid", control.Property("Class Name"), "Find property by name (UIA_ClassNamePropertyId)");
            Assert.AreEqual(5, control.Property("Row Count"), "row count");
            Assert.AreEqual(3, control.Property("Column Count"), "column count");
        }
        public void PatternTest1()
        {
            var fixture = new UiAutomationFixture();

            try
            {
                UiAutomationFixture.TimeoutSeconds = 1;
                UiAutomationFixture.SearchBy("Name");
                Assert.IsTrue(fixture.StartApplication("notepad.exe"), "Notepad started");
                var control = fixture.GetControl("classname:edit");
                var pattern = new LegacyIAccessiblePattern(control.AutomationElement);
                Assert.AreEqual(SetResult.Success, pattern.TrySet("hello"));
                Assert.IsTrue(pattern.TryGet(out var content));
                Assert.AreEqual("hello", content);
            }
            finally
            {
                fixture.ForcedCloseApplication();
            }
        }