public void DoClickButtonInWindow() { int leftClickCount = 0; int rightClickCount = 0; Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(); // Now do the actions specific to this test. (replace this for new tests) testRunner.ClickByName("left", 1); testRunner.Wait(.5); resultsHarness.AddTestResult(leftClickCount == 1, "Got left button click"); testRunner.ClickByName("right", 1); testRunner.Wait(.5); resultsHarness.AddTestResult(rightClickCount == 1, "Got right button click"); testRunner.DragDropByName("left", "right", offsetDrag: new Point2D(1, 0)); testRunner.Wait(.5); resultsHarness.AddTestResult(leftClickCount == 1, "Mouse down not a click"); }; SystemWindow buttonContainer = new SystemWindow(300, 200); Button leftButton = new Button("left", 10, 40); leftButton.Name = "left"; leftButton.Click += (sender, e) => { leftClickCount++; }; buttonContainer.AddChild(leftButton); Button rightButton = new Button("right", 110, 40); rightButton.Click += (sender, e) => { rightClickCount++; }; rightButton.Name = "right"; buttonContainer.AddChild(rightButton); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 3); // make sure we can all our tests }