feat(uns): tag + virtual-tag modals wired into the tree
This commit is contained in:
@@ -2,6 +2,7 @@ using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Uns;
|
||||
|
||||
@@ -142,4 +143,58 @@ public sealed class UnsTreeServiceLoadEditTests
|
||||
drivers[1].DriverInstanceId.ShouldBe("DRV-B");
|
||||
drivers[1].Display.ShouldBe("DRV-B — modbus-b (ModbusTcp)");
|
||||
}
|
||||
|
||||
/// <summary>Loading a seeded tag maps its fields, owning equipment, and a non-empty RowVersion.</summary>
|
||||
[Fact]
|
||||
public async Task LoadTag_returns_dto()
|
||||
{
|
||||
var (service, _) = Seeded();
|
||||
|
||||
var dto = await service.LoadTagAsync("TAG-1");
|
||||
|
||||
dto.ShouldNotBeNull();
|
||||
dto.TagId.ShouldBe("TAG-1");
|
||||
dto.EquipmentId.ShouldBe(UnsTreeTestDb.SeededEquipmentId);
|
||||
dto.Name.ShouldBe("speed");
|
||||
dto.DriverInstanceId.ShouldBe("DRV-1");
|
||||
dto.DataType.ShouldBe("Float");
|
||||
dto.AccessLevel.ShouldBe(TagAccessLevel.Read);
|
||||
dto.TagConfig.ShouldBe("{}");
|
||||
dto.RowVersion.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
/// <summary>Loading a missing tag returns null.</summary>
|
||||
[Fact]
|
||||
public async Task LoadTag_missing_returns_null()
|
||||
{
|
||||
var (service, _) = Seeded();
|
||||
|
||||
(await service.LoadTagAsync("NOPE")).ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>Loading a seeded virtual tag maps its fields, owning equipment, and a non-empty RowVersion.</summary>
|
||||
[Fact]
|
||||
public async Task LoadVirtualTag_returns_dto()
|
||||
{
|
||||
var (service, _) = Seeded();
|
||||
|
||||
var dto = await service.LoadVirtualTagAsync("VTAG-1");
|
||||
|
||||
dto.ShouldNotBeNull();
|
||||
dto.VirtualTagId.ShouldBe("VTAG-1");
|
||||
dto.EquipmentId.ShouldBe(UnsTreeTestDb.SeededEquipmentId);
|
||||
dto.Name.ShouldBe("computed");
|
||||
dto.DataType.ShouldBe("Double");
|
||||
dto.ScriptId.ShouldBe("SCRIPT-1");
|
||||
dto.RowVersion.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
/// <summary>Loading a missing virtual tag returns null.</summary>
|
||||
[Fact]
|
||||
public async Task LoadVirtualTag_missing_returns_null()
|
||||
{
|
||||
var (service, _) = Seeded();
|
||||
|
||||
(await service.LoadVirtualTagAsync("NOPE")).ShouldBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user