docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)

Comment/XML-doc changes only:
- add summaries to ~10k test methods, fixtures, fakes and helpers
  (+ <param> on theories, <returns> on async Task methods,
  <inheritdoc/> on interface implementations the checker can resolve)
- strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N,
  #NN, Component-0NN) from comments, keeping the explanatory text;
  reword false positives in comments only
- real docs on fakes implementing BCL/library interfaces
  (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime)
- reword the last 5 src/ false positives (CWE-1236, failures-1,
  year-0001, M365)

Only non-comment edits: four one-line nested classes split across lines
so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -3,15 +3,16 @@ using ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Adapters;
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests;
/// <summary>Task-11: pure OPC UA A&C field → AlarmConditionState/transition mapping.</summary>
/// <summary>Pure OPC UA A&C field → AlarmConditionState/transition mapping.</summary>
public class OpcUaAlarmMapperTests
{
// ── Gitea #17: routing identity must be the binding, not the event name ──
// ── Routing identity must be the binding, not the event name ──
/// <summary>Verifies that a NodeId binding routes on the binding rather than the event name.</summary>
[Fact]
public void BuildIdentity_NodeIdBinding_RoutesOnBindingNotName()
{
// OtOpcUa v3 post-#473: SourceName is the RawPath, ConditionName the leaf. The
// OtOpcUa v3 post-migration: SourceName is the RawPath, ConditionName the leaf. The
// binding is a durable node reference. The bug was SourceObjectReference = SourceName,
// which never prefix-matches a NodeId binding, so every transition was dropped.
var (sourceRef, sourceObjectRef) = OpcUaAlarmMapper.BuildIdentity(
@@ -25,6 +26,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("pymodbus/plc/HR200.HR200", sourceRef);
}
/// <summary>Verifies that a legacy index binding routes verbatim.</summary>
[Fact]
public void BuildIdentity_LegacyIndexBinding_RoutesVerbatim()
{
@@ -38,6 +40,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("ns=2;s=pymodbus/plc/HR200", sourceObjectRef);
}
/// <summary>Verifies that an aggregate feed keeps an empty identity.</summary>
[Fact]
public void BuildIdentity_AggregateFeed_StaysEmpty()
{
@@ -53,6 +56,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("pymodbus/plc/HR200.HR200", sourceRef);
}
/// <summary>Verifies that a missing condition name uses the source name alone.</summary>
[Fact]
public void BuildIdentity_NoConditionName_UsesSourceNameAlone()
{
@@ -64,6 +68,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("Tank01", sourceRef);
}
/// <summary>Verifies that a missing source name falls back to the binding for the key.</summary>
[Fact]
public void BuildIdentity_NoSourceName_FallsBackToBindingForKey()
{
@@ -77,6 +82,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("ns=2;s=X", sourceObjectRef);
}
/// <summary>Verifies that severity normalization clamps to the range 0 to 1000.</summary>
[Fact]
public void NormalizeSeverity_ClampsTo0_1000()
{
@@ -85,6 +91,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal(500, OpcUaAlarmMapper.NormalizeSeverity(500));
}
/// <summary>Verifies that an active, unacknowledged event builds the expected condition state.</summary>
[Fact]
public void BuildCondition_ActiveUnacked()
{
@@ -96,6 +103,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal(AlarmShelveState.Unshelved, c.Shelve);
}
/// <summary>Verifies that an acknowledge edge yields an Acknowledge transition.</summary>
[Fact]
public void DeriveKind_AckEdge_YieldsAcknowledge()
{
@@ -103,6 +111,7 @@ public class OpcUaAlarmMapperTests
OpcUaAlarmMapper.DeriveKind(prevAcked: false, nowAcked: true, prevActive: true, nowActive: true));
}
/// <summary>Verifies that an active edge yields a Raise transition.</summary>
[Fact]
public void DeriveKind_ActiveEdge_YieldsRaise()
{
@@ -110,6 +119,7 @@ public class OpcUaAlarmMapperTests
OpcUaAlarmMapper.DeriveKind(prevAcked: true, nowAcked: true, prevActive: false, nowActive: true));
}
/// <summary>Verifies that an inactive edge yields a Clear transition.</summary>
[Fact]
public void DeriveKind_InactiveEdge_YieldsClear()
{
@@ -117,6 +127,9 @@ public class OpcUaAlarmMapperTests
OpcUaAlarmMapper.DeriveKind(prevAcked: true, nowAcked: true, prevActive: true, nowActive: false));
}
/// <summary>Verifies that the current shelving state name maps to the expected shelve state.</summary>
/// <param name="name">The shelving state name reported by the source, or null.</param>
/// <param name="expected">The expected shelve state.</param>
[Theory]
[InlineData("OneShotShelved", AlarmShelveState.OneShotShelved)]
[InlineData("TimedShelved", AlarmShelveState.TimedShelved)]
@@ -127,8 +140,9 @@ public class OpcUaAlarmMapperTests
Assert.Equal(expected, OpcUaAlarmMapper.MapShelve(name));
}
// ── PickLimitValue (M2.13 / #27) ─────────────────────────────────────────
// ── PickLimitValue ─────────────────────────────────────────
/// <summary>Verifies that a set of all-null limits returns an empty value.</summary>
[Fact]
public void PickLimitValue_AllNull_ReturnsEmpty()
{
@@ -136,6 +150,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("", OpcUaAlarmMapper.PickLimitValue(null, null, null, null));
}
/// <summary>Verifies that a present high-high limit is returned.</summary>
[Fact]
public void PickLimitValue_HighHighLimitPresent_ReturnsIt()
{
@@ -144,6 +159,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("100.5", result);
}
/// <summary>Verifies that when only the high limit is present it is returned.</summary>
[Fact]
public void PickLimitValue_OnlyHighLimit_ReturnsHighLimit()
{
@@ -152,6 +168,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("80", result);
}
/// <summary>Verifies that the high-high limit wins over the high limit when both are present.</summary>
[Fact]
public void PickLimitValue_PriorityOrder_HighHighWinsOverHigh()
{
@@ -160,6 +177,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("95", result);
}
/// <summary>Verifies that when only the low-low limit is present it is returned.</summary>
[Fact]
public void PickLimitValue_OnlyLowLow_ReturnsLowLow()
{
@@ -168,6 +186,7 @@ public class OpcUaAlarmMapperTests
Assert.Equal("-10.5", result);
}
/// <summary>Verifies that limit values are formatted using the invariant culture.</summary>
[Fact]
public void PickLimitValue_UsesInvariantCulture()
{
@@ -184,6 +203,7 @@ public class OpcUaAlarmMapperTests
private static readonly DateTimeOffset Observed =
new(2026, 8, 1, 10, 5, 0, TimeSpan.Zero);
/// <summary>Verifies that an active, acknowledged alarm prefers the source acknowledgement time.</summary>
[Fact]
public void DeriveAckTime_ActiveAcked_PrefersTheSourcesOwnAckInstant()
{
@@ -195,6 +215,7 @@ public class OpcUaAlarmMapperTests
OpcUaAlarmMapper.DeriveAckTime(active: true, acked: true, SourceAck, Observed));
}
/// <summary>Verifies that an active, acknowledged alarm without a source time falls back to the observation time.</summary>
[Fact]
public void DeriveAckTime_ActiveAcked_WithoutSourceTime_FallsBackToObservationTime()
{
@@ -206,6 +227,7 @@ public class OpcUaAlarmMapperTests
OpcUaAlarmMapper.DeriveAckTime(active: true, acked: true, sourceAckTime: null, Observed));
}
/// <summary>Verifies that an unacknowledged alarm has no acknowledgement time even when the source reports an acknowledgement transition.</summary>
[Fact]
public void DeriveAckTime_Unacked_IsNull_EvenWhenSourceReportsAnAckTransition()
{
@@ -216,6 +238,7 @@ public class OpcUaAlarmMapperTests
active: true, acked: false, sourceAckTime: SourceAck, Observed));
}
/// <summary>Verifies that an inactive alarm has no acknowledgement time.</summary>
[Fact]
public void DeriveAckTime_Inactive_IsNull()
{