void RunTest(AccessibilityTest test) { using (RegistryHelper reg = new RegistryHelper()) { reg.BackupRegistry(); using (CmdApp app = new CmdApp(CreateType.ProcessOnly, TestContext)) { using (WinEventSystem sys = app.AttachWinEventSystem(this)) { using (ViewportArea area = new ViewportArea(app)) { Globals.WaitForTimeout(); // wait for everything to settle with winevents IntPtr hConsole = app.GetStdOutHandle(); // Prep structures to hold cursor and size of buffer. WinCon.CONSOLE_SCREEN_BUFFER_INFO_EX sbiex = new WinCon.CONSOLE_SCREEN_BUFFER_INFO_EX(); sbiex.cbSize = (uint)Marshal.SizeOf(sbiex); // this is where we will hold our expected messages Queue <EventData> expected = new Queue <EventData>(); NativeMethods.Win32BoolHelper(WinCon.GetConsoleScreenBufferInfoEx(hConsole, ref sbiex), "Get initial console data."); WinCon.CONSOLE_SCREEN_BUFFER_INFO_EX sbiexOriginal = sbiex; // keep a copy of the original data for later. // Run the test test(app, area, hConsole, sbiex, expected, sbiexOriginal); } } } } }