using CursorLang.Agent.Windows; using CursorLang.Core.Services; using CursorLang.Tests.Shared; namespace CursorLang.Agent.Tests.Windows; /// /// The one thing the settings window says to the agent. /// /// /// Both halves of it live apart — the message and the window class name in Core, the /// window that answers in the agent — and nothing but a matching pair makes it work. /// A renamed class or a renamed message would leave the agent showing yesterday's /// settings until it is restarted, and nothing else would complain. /// /// The agent's own window is used rather than a stand-in: what is being checked is /// that the window the agent really creates is the one the message reaches. /// public sealed class SettingsSignalTests { [Fact] public void The_signal_reaches_the_agents_window() { var delivered = 0; using AgentWindow window = Pump.Run(() => { var created = new AgentWindow(); created.AddFilter((message, _, _) => { if (message != SettingsSignal.Message) { return false; } delivered++; return true; }); return created; }); Pump.Run(SettingsSignal.NotifyAgent); Pump.Drain(); Assert.Equal(1, delivered); } // Nobody is listening, and that is a normal state of affairs: the settings window // works perfectly well with no agent behind it [Fact] public void Signalling_with_no_agent_running_passes_without_consequence() { Pump.Run(SettingsSignal.NotifyAgent); Pump.Drain(); } }