fix(adminui): alias update pins invariants + LoadAliasTagAsync + null-driver guard (review)
This commit is contained in:
@@ -288,6 +288,8 @@ public sealed class UnsTreeServiceAliasTagTests
|
||||
doc.RootElement.GetProperty("FullName").GetString().ShouldBe("TestMachine_020.Speed");
|
||||
tag.TagConfig.ShouldContain("FullName");
|
||||
tag.TagConfig.ShouldContain("TestMachine_020.Speed");
|
||||
tag.WriteIdempotent.ShouldBeFalse();
|
||||
tag.PollGroupId.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>An empty/whitespace Galaxy reference is rejected before anything is written.</summary>
|
||||
@@ -364,6 +366,44 @@ public sealed class UnsTreeServiceAliasTagTests
|
||||
result.Error!.ShouldContain("speed-alias");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="UnsTreeService.LoadAliasTagAsync"/> returns a DTO whose <c>FullName</c> matches the
|
||||
/// TagConfig and whose <c>RowVersion</c> is non-empty.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task LoadAliasTag_returns_dto_with_FullName()
|
||||
{
|
||||
var dbName = SeedCluster();
|
||||
|
||||
using (var db = UnsTreeTestDb.CreateNamed(dbName))
|
||||
{
|
||||
db.Tags.Add(new Tag
|
||||
{
|
||||
TagId = "TAG-LOAD-ALIAS",
|
||||
DriverInstanceId = GatewayDriverId,
|
||||
EquipmentId = EquipmentId,
|
||||
Name = "loaded-speed",
|
||||
DataType = "Float",
|
||||
AccessLevel = TagAccessLevel.ReadWrite,
|
||||
TagConfig = "{\"FullName\":\"TestMachine_020.LoadedSpeed\"}",
|
||||
});
|
||||
db.SaveChanges();
|
||||
}
|
||||
|
||||
var service = new UnsTreeService(UnsTreeTestDb.Factory(dbName));
|
||||
|
||||
var dto = await service.LoadAliasTagAsync("TAG-LOAD-ALIAS");
|
||||
|
||||
dto.ShouldNotBeNull();
|
||||
dto!.TagId.ShouldBe("TAG-LOAD-ALIAS");
|
||||
dto.Name.ShouldBe("loaded-speed");
|
||||
dto.DriverInstanceId.ShouldBe(GatewayDriverId);
|
||||
dto.DataType.ShouldBe("Float");
|
||||
dto.AccessLevel.ShouldBe(TagAccessLevel.ReadWrite);
|
||||
dto.FullName.ShouldBe("TestMachine_020.LoadedSpeed");
|
||||
dto.RowVersion.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update changes the alias's name, data type, access level, and Galaxy reference, returning Ok and
|
||||
/// persisting the new values and the refreshed <c>{"FullName":…}</c> TagConfig.
|
||||
|
||||
Reference in New Issue
Block a user