Automation.UI.Tests.TestUIComponent.TestExecute C# (CSharp) Method

TestExecute() private method

private TestExecute ( ) : void
return void
        public void TestExecute()
        {
            // Fire the query.
            var window = Query().Where()
                .Name().StartsWith("UIAutomation")
                .And()
                .Name().Contains("Visual Studio")
                .Select().FirstResult();
            // Validate the result.
            Assert.IsNotNull(window);

            // Execute arbitrary steps using the 'Window' pattern.
            window.Execute<WindowPattern>(p => p.SetWindowVisualState(WindowVisualState.Minimized));
            // Validate the result.
            var windowPattern = (WindowPattern) window.Element.GetCurrentPattern(WindowPattern.Pattern);
            var state = windowPattern.Current.WindowVisualState;
            Assert.IsTrue(state == WindowVisualState.Minimized);
            // Restore.
            windowPattern.SetWindowVisualState(WindowVisualState.Maximized);
        }