From a56805e6819c9b5daae259ca9bd43a6876d19712 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 18 Jun 2026 03:38:43 -0400 Subject: [PATCH] test(centralui): register IEndpointVerificationService in OpcUaEndpointEditor/DataConnectionForm fixtures broken by B8 verify-button (T17) --- .../DataConnectionFormTests.cs | 4 ++++ .../Forms/OpcUaEndpointEditorTests.cs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionFormTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionFormTests.cs index 9a2bc496..064f613e 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionFormTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionFormTests.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection; using NSubstitute; +using ZB.MOM.WW.ScadaBridge.CentralUI.Services; using ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites; using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories; using DataConnectionForm = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Design.DataConnectionForm; @@ -19,6 +20,9 @@ public class DataConnectionFormTests : BunitContext public DataConnectionFormTests() { Services.AddSingleton(_siteRepo); + // The OPC UA editor rendered inside the form injects IEndpointVerificationService + // (B8 / T17 Verify-endpoint button); a no-op substitute satisfies the injection. + Services.AddSingleton(Substitute.For()); AddTestAuth(); var sites = new List { new("Plant-A", "plant-a") { Id = 1 } }; _siteRepo.GetAllSitesAsync(Arg.Any()) diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Forms/OpcUaEndpointEditorTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Forms/OpcUaEndpointEditorTests.cs index 3c0dd6bd..970e1bd7 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Forms/OpcUaEndpointEditorTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Forms/OpcUaEndpointEditorTests.cs @@ -1,4 +1,7 @@ using Bunit; +using Microsoft.Extensions.DependencyInjection; +using NSubstitute; +using ZB.MOM.WW.ScadaBridge.CentralUI.Services; using ZB.MOM.WW.ScadaBridge.Commons.Types.DataConnections; using ZB.MOM.WW.ScadaBridge.Commons.Types.Flattening; using ZB.MOM.WW.ScadaBridge.Commons.Validators; @@ -8,6 +11,14 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Forms; public class OpcUaEndpointEditorTests : BunitContext { + public OpcUaEndpointEditorTests() + { + // OpcUaEndpointEditor injects IEndpointVerificationService for its Verify-endpoint + // button (B8 / T17). These tests only exercise the form bindings, so a no-op + // substitute satisfies the injection without driving verification. + Services.AddSingleton(Substitute.For()); + } + [Fact] public void Renders_All_Four_Section_Labels() {