Files
lmxopcua/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/Uns/UnsTreeServiceEquipmentPickContextTests.cs
T
Joseph Doherty b211911f98
v2-ci / unit-tests (push) Failing after 13m22s
test: migrate AdminUI/ControlPlane/Runtime/Host tests to xunit.v3 (#756)
Akka.TestKit.Xunit2 -> Akka.TestKit.Xunit 1.5.62 (xunit.v3 TestKit; needs xunit.v3 3.2.2, set via
VersionOverride on the four projects). Removes the xunit 2.9.3 pin. IAsyncLifetime returns ValueTask,
SqlServerFactAttribute gains the source-info ctor, and xUnit1051 call sites pass
TestContext.Current.CancellationToken. Test counts unchanged.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-10 08:57:33 -05:00

37 lines
1.3 KiB
C#

using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Uns;
/// <summary>
/// Verifies <see cref="UnsTreeService.LoadEquipmentPickContextAsync"/> resolves a line to its owning
/// cluster and returns that cluster's lines (for the equipment page's Details-tab line picker), and
/// returns empty option lists when the line is null or cannot be resolved.
/// </summary>
[Trait("Category", "Unit")]
public sealed class UnsTreeServiceEquipmentPickContextTests
{
private static UnsTreeService SeededService()
{
var dbName = $"uns-pickctx-{Guid.NewGuid():N}";
UnsTreeTestDb.SeedNamed(dbName);
return new UnsTreeService(UnsTreeTestDb.Factory(dbName));
}
[Fact]
public async Task ResolvesClusterLines_forKnownLine()
{
var ctx = await SeededService().LoadEquipmentPickContextAsync("LINE-1", TestContext.Current.CancellationToken);
ctx.Lines.ShouldContain(o => o.Id == "LINE-1");
}
[Fact]
public async Task Empty_for_null_or_unknown_line()
{
var svc = SeededService();
(await svc.LoadEquipmentPickContextAsync(null, TestContext.Current.CancellationToken)).Lines.ShouldBeEmpty();
(await svc.LoadEquipmentPickContextAsync("NOPE", TestContext.Current.CancellationToken)).Lines.ShouldBeEmpty();
}
}