コード例 #1
0
        public void CodedUITestMethod1()
        {
            var mainWindow = GetMainWindow();

            var btn = new WpfButton(mainWindow);

            btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape"));
            btn.Find();
            btn.WaitForControlReady();
            Mouse.Click(btn);

            var diagram = new WpfCustom(mainWindow);

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();

            var element = new WpfCustom(diagram);

            element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1"));
            element.Find();
            element.WaitForControlReady();

            var itemsControl = new WpfList(element);

            itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC"));

            //The CodedUI can't find the ItemsControl
            itemsControl.Find();
            itemsControl.WaitForControlReady();
            var items = itemsControl.Items.OfType <WpfListItem>().ToArray();

            string[] s = items.Select(x => x.AutomationId).ToArray();
            s.Should().BeEquivalentTo("ItemA", "ItemB", "ItemC", "ItemD", "ItemE", "ItemF", "ItemG", "ItemH");
        }
コード例 #2
0
        public void CodedUITestMethod1()
        {
            var mainWindow = GetMainWindow();

            var btn = new WpfButton(mainWindow);

            btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape"));
            btn.Find();
            btn.WaitForControlReady();
            Mouse.Click(btn);

            var diagram = new WpfCustom(mainWindow);

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();

            var element = new WpfCustom(diagram);

            element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1"));
            element.Find();
            element.WaitForControlReady();

            var itemsControl = new WpfList(element);

            itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC"));

            //The CodedUI can't find the ItemsControl
            itemsControl.Find();
            itemsControl.WaitForControlReady();
            string[] s = itemsControl.Items.GetValuesOfControls();
        }
コード例 #3
0
 private WpfButton FeedbackWindow_CancelButton()
 {
     WpfButton theButton = new WpfButton(GetFeedbackWindow());
     theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Cancel";
     theButton.Find();
     return theButton;
 }
コード例 #4
0
        private WpfButton FeedbackWindow_CancelButton()
        {
            WpfButton theButton = new WpfButton(GetFeedbackWindow());

            theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Cancel";
            theButton.Find();
            return(theButton);
        }
コード例 #5
0
        private WpfButton FeedbackWindow_OpenDefaultEmailButton()
        {
            var feedbackWindow = GetFeedbackWindow();
            var children       = feedbackWindow.GetChildren();

            foreach (var child in children)
            {
                if (child.GetProperty("AutomationId").ToString() == "FeebackView_Send")
                {
                    return(child as WpfButton);
                }
            }
            WpfButton theButton = new WpfButton(feedbackWindow);

            theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Send";
            theButton.Find();
            return(theButton);
        }
コード例 #6
0
        public void CodedUITestMethod1()
        {
            System.Threading.Thread.Sleep(1000);
            var mainWindow = new WpfWindow();

            mainWindow.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "Main_Window"));
            mainWindow.Find();
            var btn = new WpfButton();

            btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape"));
            btn.Find();
            btn.WaitForControlReady();
            btn.GetClickablePoint();

            Mouse.Click(mainWindow, new Point(btn.Top + 20, btn.Left + 20));
            //Mouse.Click(new Point(btn.BoundingRectangle.X + btn.BoundingRectangle.Width / 2, btn.BoundingRectangle.Y + btn.BoundingRectangle.Height / 2));
            //Mouse.Click(new Point(btn.GetClickablePoint().X, btn.GetClickablePoint().Y));
            var diagram = new WpfWindow();

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        }
コード例 #7
0
 private WpfButton FeedbackWindow_OpenDefaultEmailButton()
 {
     var feedbackWindow = GetFeedbackWindow();
     var children = feedbackWindow.GetChildren();
     foreach(var child in children)
     {
         if(child.GetProperty("AutomationId").ToString() == "FeebackView_Send")
         {
             return child as WpfButton;
         }
     }
     WpfButton theButton = new WpfButton(feedbackWindow);
     theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Send";
     theButton.Find();
     return theButton;
 }