fix(mtconnect): options carry the authored tag definitions (Task 2 follow-up)
This commit is contained in:
@@ -56,6 +56,47 @@ public sealed class MTConnectDriverOptionsTests
|
||||
reconnect.BackoffMultiplier.ShouldBeGreaterThan(1.0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="MTConnectDriverOptions.Tags"/> defaults to an <i>empty</i> collection, never
|
||||
/// <c>null</c> — a null collection here is an operator-authorable NullReferenceException at
|
||||
/// deploy, since a driver instance authored with no tags binds this default.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Options_tags_default_to_empty_and_are_never_null()
|
||||
{
|
||||
var o = new MTConnectDriverOptions { AgentUri = "http://agent:5000" };
|
||||
|
||||
o.Tags.ShouldNotBeNull();
|
||||
o.Tags.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A populated options object carries the authored tag definitions through unchanged —
|
||||
/// the observation index (Task 8) coerces each present observation to <i>its tag's</i>
|
||||
/// DriverDataType, so the definitions must reach the driver from the factory config.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Options_round_trip_the_authored_tag_definitions()
|
||||
{
|
||||
var pos = new MTConnectTagDefinition(
|
||||
FullName: "dev1_pos",
|
||||
DriverDataType: ZB.MOM.WW.OtOpcUa.Core.Abstractions.DriverDataType.Float64,
|
||||
MtCategory: "SAMPLE",
|
||||
MtType: "POSITION",
|
||||
Units: "MILLIMETER");
|
||||
var partCount = new MTConnectTagDefinition(
|
||||
FullName: "dev1_partcount",
|
||||
DriverDataType: ZB.MOM.WW.OtOpcUa.Core.Abstractions.DriverDataType.Int64,
|
||||
MtCategory: "EVENT",
|
||||
MtType: "PART_COUNT");
|
||||
|
||||
var o = new MTConnectDriverOptions { AgentUri = "http://agent:5000", Tags = [pos, partCount] };
|
||||
|
||||
o.Tags.Count.ShouldBe(2);
|
||||
o.Tags[0].ShouldBe(pos);
|
||||
o.Tags[1].ShouldBe(partCount);
|
||||
}
|
||||
|
||||
/// <summary>MTConnectTagDefinition round-trips its positional fields, including MTConnect metadata.</summary>
|
||||
[Fact]
|
||||
public void TagDefinition_carries_dataItemId_and_mtconnect_metadata()
|
||||
|
||||
Reference in New Issue
Block a user