Refine XML docs for historian, OPC UA, and tests

This commit is contained in:
Joseph Doherty
2026-03-26 15:33:14 -04:00
parent 3c326e2d45
commit ce0b291664
14 changed files with 215 additions and 3 deletions

View File

@@ -6,6 +6,11 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain
{
public class SecurityClassificationMapperTests
{
/// <summary>
/// Verifies that Galaxy classifications intended for operator and engineering writes remain writable through OPC UA.
/// </summary>
/// <param name="classification">The Galaxy security classification value being evaluated for write access.</param>
/// <param name="expected">The expected writable result for the supplied Galaxy classification.</param>
[Theory]
[InlineData(0, true)] // FreeAccess
[InlineData(1, true)] // Operate
@@ -16,6 +21,11 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain
SecurityClassificationMapper.IsWritable(classification).ShouldBe(expected);
}
/// <summary>
/// Verifies that secured or view-only Galaxy classifications are exposed as read-only attributes.
/// </summary>
/// <param name="classification">The Galaxy security classification value expected to block writes.</param>
/// <param name="expected">The expected writable result for the supplied read-only Galaxy classification.</param>
[Theory]
[InlineData(2, false)] // SecuredWrite
[InlineData(3, false)] // VerifiedWrite
@@ -25,6 +35,10 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain
SecurityClassificationMapper.IsWritable(classification).ShouldBe(expected);
}
/// <summary>
/// Verifies that unknown security classifications do not accidentally block writes for unmapped Galaxy values.
/// </summary>
/// <param name="classification">An unmapped Galaxy security classification value that should fall back to writable behavior.</param>
[Theory]
[InlineData(-1)]
[InlineData(7)]

View File

@@ -7,18 +7,28 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Historian
{
public class HistorianQualityMappingTests
{
/// <summary>
/// Verifies that the Historian good-quality sentinel is surfaced to OPC UA clients as a good status code.
/// </summary>
[Fact]
public void Quality0_MapsToGood()
{
HistorianDataSource.MapQuality(0).ShouldBe(StatusCodes.Good);
}
/// <summary>
/// Verifies that the Historian bad-quality sentinel is surfaced to OPC UA clients as a bad status code.
/// </summary>
[Fact]
public void Quality1_MapsToBad()
{
HistorianDataSource.MapQuality(1).ShouldBe(StatusCodes.Bad);
}
/// <summary>
/// Verifies that Historian uncertainty quality bands are translated into OPC UA uncertain results.
/// </summary>
/// <param name="quality">A Wonderware Historian quality byte in the uncertain range.</param>
[Theory]
[InlineData(128)]
[InlineData(133)]
@@ -28,6 +38,10 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Historian
HistorianDataSource.MapQuality(quality).ShouldBe(StatusCodes.Uncertain);
}
/// <summary>
/// Verifies that nonzero non-uncertain Historian quality values are treated as bad historical samples.
/// </summary>
/// <param name="quality">A Wonderware Historian quality byte that should map to an OPC UA bad status.</param>
[Theory]
[InlineData(2)]
[InlineData(50)]

View File

@@ -31,6 +31,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
};
}
/// <summary>
/// Verifies that writable Galaxy security classifications publish OPC UA variables with read-write access.
/// </summary>
[Fact]
public async Task ReadWriteAttribute_HasCurrentReadOrWrite_AccessLevel()
{
@@ -52,6 +55,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that secured and view-only Galaxy classifications publish OPC UA variables with read-only access.
/// </summary>
[Fact]
public async Task ReadOnlyAttribute_HasCurrentRead_AccessLevel()
{
@@ -73,6 +79,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that the bridge rejects writes against Galaxy attributes whose security classification is read-only.
/// </summary>
[Fact]
public async Task Write_ToReadOnlyAttribute_IsRejected()
{
@@ -90,6 +99,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that writes succeed for Galaxy attributes whose security classification permits operator updates.
/// </summary>
[Fact]
public async Task Write_ToReadWriteAttribute_Succeeds()
{

View File

@@ -27,6 +27,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
};
}
/// <summary>
/// Verifies that historized Galaxy attributes advertise OPC UA historizing support and history-read access.
/// </summary>
[Fact]
public async Task HistorizedAttribute_HasHistorizingTrue_AndHistoryReadAccess()
{
@@ -49,6 +52,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that non-historized Galaxy attributes do not claim OPC UA history support.
/// </summary>
[Fact]
public async Task NormalAttribute_HasHistorizingFalse_AndNoHistoryReadAccess()
{

View File

@@ -11,6 +11,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
{
public class IncrementalSyncTests
{
/// <summary>
/// Verifies that adding a new Galaxy object and attribute causes the corresponding OPC UA node subtree to appear after sync.
/// </summary>
[Fact]
public async Task Sync_AddObject_NewNodeAppears()
{
@@ -56,6 +59,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that removing a Galaxy object tears down the corresponding OPC UA subtree without affecting siblings.
/// </summary>
[Fact]
public async Task Sync_RemoveObject_NodeDisappears()
{
@@ -87,6 +93,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that adding a Galaxy attribute creates a new OPC UA variable during incremental rebuild.
/// </summary>
[Fact]
public async Task Sync_AddAttribute_NewVariableAppears()
{
@@ -114,6 +123,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that subscriptions on unchanged objects continue receiving data after unrelated subtree rebuilds.
/// </summary>
[Fact]
public async Task Sync_UnchangedObject_SubscriptionSurvives()
{
@@ -148,6 +160,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Integration
finally { await fixture.DisposeAsync(); }
}
/// <summary>
/// Verifies that a rebuild request with no repository changes leaves the published namespace intact.
/// </summary>
[Fact]
public async Task Sync_NoChanges_NothingHappens()
{

View File

@@ -14,6 +14,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
private static GalaxyAttributeInfo Attr(int gobjectId, string name, string tagName = "Obj", int mxDataType = 5)
=> new GalaxyAttributeInfo { GobjectId = gobjectId, AttributeName = name, FullTagReference = $"{tagName}.{name}", MxDataType = mxDataType, TagName = tagName };
/// <summary>
/// Verifies that identical Galaxy hierarchy and attribute snapshots produce no incremental rebuild work.
/// </summary>
[Fact]
public void NoChanges_ReturnsEmptySet()
{
@@ -24,6 +27,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldBeEmpty();
}
/// <summary>
/// Verifies that newly deployed Galaxy objects are flagged for OPC UA subtree creation.
/// </summary>
[Fact]
public void AddedObject_Detected()
{
@@ -36,6 +42,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldNotContain(1);
}
/// <summary>
/// Verifies that removed Galaxy objects are flagged so their OPC UA subtree can be torn down.
/// </summary>
[Fact]
public void RemovedObject_Detected()
{
@@ -48,6 +57,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldNotContain(1);
}
/// <summary>
/// Verifies that browse-name changes are treated as address-space changes for the affected Galaxy object.
/// </summary>
[Fact]
public void ModifiedObject_BrowseNameChange_Detected()
{
@@ -59,6 +71,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(1);
}
/// <summary>
/// Verifies that parent changes are treated as subtree moves that require rebuilding the affected object.
/// </summary>
[Fact]
public void ModifiedObject_ParentChange_Detected()
{
@@ -70,6 +85,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(2);
}
/// <summary>
/// Verifies that adding a Galaxy attribute marks the owning object for OPC UA variable rebuild.
/// </summary>
[Fact]
public void AttributeAdded_Detected()
{
@@ -81,6 +99,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(1);
}
/// <summary>
/// Verifies that removing a Galaxy attribute marks the owning object for OPC UA variable rebuild.
/// </summary>
[Fact]
public void AttributeRemoved_Detected()
{
@@ -92,6 +113,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(1);
}
/// <summary>
/// Verifies that changes to attribute field metadata such as MX data type trigger rebuild of the owning object.
/// </summary>
[Fact]
public void AttributeFieldChange_Detected()
{
@@ -103,6 +127,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(1);
}
/// <summary>
/// Verifies that security-classification changes are treated as address-space changes for the owning attribute.
/// </summary>
[Fact]
public void AttributeSecurityChange_Detected()
{
@@ -114,6 +141,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
changed.ShouldContain(1);
}
/// <summary>
/// Verifies that subtree expansion includes all descendants of a changed Galaxy object.
/// </summary>
[Fact]
public void ExpandToSubtrees_IncludesChildren()
{
@@ -136,6 +166,9 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.OpcUa
expanded.ShouldNotContain(5);
}
/// <summary>
/// Verifies that subtree expansion does not introduce unrelated nodes when the changed object is already a leaf.
/// </summary>
[Fact]
public void ExpandToSubtrees_LeafNode_NoExpansion()
{