using System.Diagnostics; using WhiteMagic.Input; using WhiteMagic.Windows; using Xunit; namespace WhiteMagicTest.Input; public sealed class InputSimulatorTests { [Fact(Skip = "Interactive input test - requires a visible window")] public void SendKeys_to_current_window_does_not_throw() { using var process = Process.GetCurrentProcess(); IntPtr handle = process.MainWindowHandle != IntPtr.Zero ? process.MainWindowHandle : WindowFactory.GetWindows().FirstOrDefault()?.Handle ?? IntPtr.Zero; if (handle == IntPtr.Zero) return; var simulator = new InputSimulator(); bool result = simulator.SendKeys(handle, "ab"); Assert.True(result); } [Fact(Skip = "Interactive input test - requires a visible window")] public void SendMouseClick_to_current_window_does_not_throw() { using var process = Process.GetCurrentProcess(); IntPtr handle = process.MainWindowHandle != IntPtr.Zero ? process.MainWindowHandle : WindowFactory.GetWindows().FirstOrDefault()?.Handle ?? IntPtr.Zero; if (handle == IntPtr.Zero) return; var simulator = new InputSimulator(); bool result = simulator.SendMouseClick(handle, 10, 20, MouseButton.Left); Assert.True(result); } }