Beispiel #1
0
        public void ListOfControlsTableTest()
        {
            var fixture = new UiAutomationFixture();

            fixture.StartApplication("notepad");
            var processId      = fixture.ApplicationProcessId;
            var listOfControls = new ListOfControls(processId, "ProcessId:" + processId);
            var result         = listOfControls.DoTable();
            var headerRow      = result[0] as Collection <string>;

            Assert.IsNotNull(headerRow);
            Assert.AreEqual("report:Name", headerRow[1]);
            var controls = result.Skip(1).ToList();

            Assert.IsTrue(controls.Any());
            foreach (Collection <string> row in controls)
            {
                foreach (var cell in row)
                {
                    Console.Write(cell + "; ");
                }
                Console.WriteLine();
            }

            var emptyList   = new ListOfControls(processId, "id:q");
            var emptyResult = emptyList.Query();

            Assert.IsNull(emptyResult);
            fixture.ForcedCloseApplication();
        }
Beispiel #2
0
        public void ListOfControlsQueryTest()
        {
            var listOfControls = new ListOfControls(null, "ControlType:Window");
            var result         = listOfControls.Query();
            var firstRow       = result[0] as Collection <object>;

            Assert.IsNotNull(firstRow);
            var cell1 = firstRow[0] as Collection <string>;

            Assert.IsNotNull(cell1);
            Assert.AreEqual("Automation Id", cell1[0]);
            foreach (var row in result)
            {
                var rowCollection = row as Collection <object>;
                Assert.IsNotNull(rowCollection);
                foreach (var cell in rowCollection)
                {
                    var cellCollection = cell as Collection <string>;
                    Assert.IsNotNull(cellCollection);
                    Console.Write(cellCollection[0] + ":" + cellCollection[1] + "; ");
                }
                Console.WriteLine();
            }
        }