fix(centralui-tests): register stub IBrowseService in SecuredWritesTests harness (PLAN-07 known-issue resolved)

The Secured Writes page embeds NodeBrowserDialog (@inject IBrowseService) for
the OPC UA tag picker; bUnit resolves the injected service at render time, so
three SecuredWritesTests failed with 'no registered service of type
IBrowseService'. Register a Substitute.For<IBrowseService>() singleton in the
fixture (mirrors NodeBrowserDialogSearchTests). Suite now 7/7 green.

Marks the PLAN-07 'Post-plan known issues' entry and the 00-MASTER-TRACKER
registry cross-reference RESOLVED.
This commit is contained in:
Joseph Doherty
2026-07-09 05:55:53 -04:00
parent 765ff131d8
commit 9049690bdb
3 changed files with 10 additions and 2 deletions
@@ -30,12 +30,18 @@ public class SecuredWritesTests : BunitContext
private readonly ISecuredWriteService _service = Substitute.For<ISecuredWriteService>();
private readonly ISiteRepository _siteRepo = Substitute.For<ISiteRepository>();
private readonly IDialogService _dialog = Substitute.For<IDialogService>();
// The submit region embeds a NodeBrowserDialog (@inject IBrowseService) for the
// OPC UA tag picker. The dialog is only rendered when the Operator opens it, but
// bUnit resolves the injected service at render time, so it must be registered
// even though these tests never drive the browser.
private readonly IBrowseService _browse = Substitute.For<IBrowseService>();
public SecuredWritesTests()
{
Services.AddSingleton(_service);
Services.AddSingleton(_siteRepo);
Services.AddSingleton(_dialog);
Services.AddSingleton(_browse);
// Confirm dialogs resolve to "yes" without a DialogHost in the render scope.
_dialog.ConfirmAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>())