public void MyTestInitialize() { // Find the Start button, which will be our target AutomationElement trueStartButton = AutomationElementTest.GetTaskbar(); this.startButtonHwnd = (IntPtr)trueStartButton.Current.NativeWindowHandle; }
public void MyTestInitialize() { // Find the taskbar, which will be our target AutomationElement taskBar = AutomationElementTest.GetTaskbar(); this.targetHwnd = (IntPtr)taskBar.Current.NativeWindowHandle; // Register a client side provider ClientSideProviderDescription provider = new ClientSideProviderDescription( new ClientSideProviderFactoryCallback(MockPatternProvider.MockPatternFactory), "Shell_TrayWnd"); ClientSideProviderDescription[] providers = new ClientSideProviderDescription[1] { provider }; ClientSettings.RegisterClientSideProviders(providers); // Get the overridden element this.mockObject = AutomationElement.FromHandle(this.targetHwnd); Assert.IsNotNull(this.mockObject); }