public void TestMouseWheel() { // Use a registry helper to backup and restore registry state before/after test using (RegistryHelper reg = new RegistryHelper()) { reg.BackupRegistry(); // Start our application to test using (CmdApp app = new CmdApp(CreateType.ProcessOnly, TestContext)) { Log.Comment("First ensure that word wrap is off so we can get scroll bars in both directions."); // Make sure wrap is off app.SetWrapState(false); IntPtr handle = app.GetStdOutHandle(); Verify.IsNotNull(handle, "Ensure we have the output handle."); Log.Comment("Set up the window so the buffer is larger than the window. Retrieve existing properties then set the viewport to smaller than the buffer."); WinCon.CONSOLE_SCREEN_BUFFER_INFO_EX info = app.GetScreenBufferInfo(handle); info.srWindow.Left = 0; info.srWindow.Right = 30; info.srWindow.Top = 0; info.srWindow.Bottom = 30; info.dwSize.X = 100; info.dwSize.Y = 100; app.SetScreenBufferInfo(handle, info); Log.Comment("Now retrieve the starting position of the window viewport."); Log.Comment("Scroll down one."); VerifyScroll(app, ScrollDir.Vertical, -1); Log.Comment("Scroll right one."); VerifyScroll(app, ScrollDir.Horizontal, 1); Log.Comment("Scroll left one."); VerifyScroll(app, ScrollDir.Horizontal, -1); Log.Comment("Scroll up one."); VerifyScroll(app, ScrollDir.Vertical, 1); } } }