test(centralui): register IEndpointVerificationService in OpcUaEndpointEditor/DataConnectionForm fixtures broken by B8 verify-button (T17)
This commit is contained in:
@@ -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<IEndpointVerificationService>(Substitute.For<IEndpointVerificationService>());
|
||||
AddTestAuth();
|
||||
var sites = new List<Site> { new("Plant-A", "plant-a") { Id = 1 } };
|
||||
_siteRepo.GetAllSitesAsync(Arg.Any<CancellationToken>())
|
||||
|
||||
@@ -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<IEndpointVerificationService>(Substitute.For<IEndpointVerificationService>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Renders_All_Four_Section_Labels()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user