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
@@ -7,6 +7,7 @@ public class RevisionHashServiceTests
{
private readonly RevisionHashService _sut = new();
/// <summary>Verifies that identical content produces the same hash.</summary>
[Fact]
public void ComputeHash_SameContent_SameHash()
{
@@ -19,6 +20,7 @@ public class RevisionHashServiceTests
Assert.Equal(hash1, hash2);
}
/// <summary>Verifies that different content produces a different hash.</summary>
[Fact]
public void ComputeHash_DifferentContent_DifferentHash()
{
@@ -31,6 +33,7 @@ public class RevisionHashServiceTests
Assert.NotEqual(hash1, hash2);
}
/// <summary>Verifies that the computed hash starts with the sha256 prefix.</summary>
[Fact]
public void ComputeHash_StartsWithSha256Prefix()
{
@@ -40,6 +43,7 @@ public class RevisionHashServiceTests
Assert.StartsWith("sha256:", hash);
}
/// <summary>Verifies that the hash is deterministic across runs.</summary>
[Fact]
public void ComputeHash_DeterministicAcrossRuns()
{
@@ -64,12 +68,14 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that a null configuration throws an argument-null exception.</summary>
[Fact]
public void ComputeHash_NullConfig_ThrowsArgumentNull()
{
Assert.Throws<ArgumentNullException>(() => _sut.ComputeHash(null!));
}
/// <summary>Verifies that attribute order does not affect the hash.</summary>
[Fact]
public void ComputeHash_AttributeOrder_DoesNotAffectHash()
{
@@ -99,10 +105,11 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that the hashable records declare their properties in alphabetical order.</summary>
[Fact]
public void HashableRecords_PropertiesDeclaredAlphabetically()
{
// TemplateEngine-011: revision-hash determinism depends entirely on the
// Revision-hash determinism depends entirely on the
// private Hashable* records declaring their properties in alphabetical
// order (System.Text.Json emits properties in CLR declaration order and
// does not sort). This guards against a contributor silently changing
@@ -131,10 +138,11 @@ public class RevisionHashServiceTests
}
}
/// <summary>Verifies that editing an attribute description changes the hash.</summary>
[Fact]
public void ComputeHash_AttributeDescriptionEdit_ChangesHash()
{
// TemplateEngine-017: Description must be folded into the hash so that
// Description must be folded into the hash so that
// edits to authoring-time documentation (which still travels in the
// deployed payload) flow through the staleness indicator.
var baseAttr = new ResolvedAttribute
@@ -158,10 +166,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that editing an alarm description changes the hash.</summary>
[Fact]
public void ComputeHash_AlarmDescriptionEdit_ChangesHash()
{
// TemplateEngine-017: same Description contract applies to alarms.
// Same Description contract applies to alarms.
var baseAlarm = new ResolvedAlarm
{
CanonicalName = "HighTemp",
@@ -182,10 +191,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that editing a connection endpoint changes the hash.</summary>
[Fact]
public void ComputeHash_ConnectionEndpointEdit_ChangesHash()
{
// TemplateEngine-017: a Deployment user editing the primary endpoint
// A Deployment user editing the primary endpoint
// JSON of a data connection bound to an instance must produce a
// different revision hash. The connection's protocol, primary/backup
// configuration JSON, and failover retry count are all part of the
@@ -220,10 +230,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that editing a connection protocol changes the hash.</summary>
[Fact]
public void ComputeHash_ConnectionProtocolEdit_ChangesHash()
{
// TemplateEngine-017: changing protocol must change the hash.
// Changing protocol must change the hash.
var connectionsBefore = new Dictionary<string, ConnectionConfig>
{
["plc1"] = new ConnectionConfig
@@ -250,10 +261,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that connections with the same content produce the same hash.</summary>
[Fact]
public void ComputeHash_ConnectionsSameContent_SameHash()
{
// TemplateEngine-017: equal Connections maps must yield the same hash,
// Equal Connections maps must yield the same hash,
// regardless of dictionary iteration order (the SortedDictionary
// projection guards this).
var connections1 = new Dictionary<string, ConnectionConfig>
@@ -279,10 +291,11 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that changing a list element data type changes the hash.</summary>
[Fact]
public void ComputeHash_ListElementDataTypeChange_ChangesHash()
{
// #290: a List attribute whose element type changes (Int32 → Double)
// A List attribute whose element type changes (Int32 → Double)
// while the JSON-encoded values stay identical MUST produce a different
// revision hash, so the deployment is flagged stale. ElementDataType is
// folded into the hashable projection precisely for this case.
@@ -307,10 +320,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that an unchanged list element data type produces the same hash.</summary>
[Fact]
public void ComputeHash_SameListElementDataType_SameHash()
{
// #290: two List attributes identical in every field — including
// Two List attributes identical in every field — including
// ElementDataType — must hash the same.
var attr = new ResolvedAttribute
{
@@ -332,10 +346,11 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that a scalar attribute hashes the same whether its element data type is null or unset.</summary>
[Fact]
public void ComputeHash_ScalarAttribute_NullVsUnsetElementDataType_SameHash()
{
// #290 no-op guard: a scalar attribute has a null ElementDataType, and
// No-op guard: a scalar attribute has a null ElementDataType, and
// the canonical serializer omits null properties
// (DefaultIgnoreCondition = WhenWritingNull). Explicitly setting
// ElementDataType = null must therefore hash identically to leaving it
@@ -367,10 +382,11 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that changing a native alarm source changes the hash.</summary>
[Fact]
public void ComputeHash_NativeAlarmSourceChange_ChangesHash()
{
// TemplateEngine-011: native alarm source bindings are part of the
// Native alarm source bindings are part of the
// deployment package, so an edit to a source's binding (here the
// SourceReference) MUST change the revision hash and flag the instance
// stale. Before this migration native sources were absent from the hash
@@ -397,10 +413,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that changing a native alarm source's locked flag changes the hash.</summary>
[Fact]
public void ComputeHash_NativeAlarmSourceIsLockedChange_ChangesHash()
{
// TemplateEngine-011: IsLocked participates in the hash too.
// IsLocked participates in the hash too.
var baseSource = new ResolvedNativeAlarmSource
{
CanonicalName = "Boiler.Alarms",
@@ -422,10 +439,11 @@ public class RevisionHashServiceTests
Assert.NotEqual(_sut.ComputeHash(configBefore), _sut.ComputeHash(configAfter));
}
/// <summary>Verifies that native alarm source order does not affect the hash.</summary>
[Fact]
public void ComputeHash_NativeAlarmSourceOrder_DoesNotAffectHash()
{
// TemplateEngine-011: sources are sorted by CanonicalName before hashing,
// Sources are sorted by CanonicalName before hashing,
// mirroring attributes/alarms/scripts — authoring order is irrelevant.
var a = new ResolvedNativeAlarmSource
{
@@ -448,10 +466,11 @@ public class RevisionHashServiceTests
Assert.Equal(_sut.ComputeHash(config1), _sut.ComputeHash(config2));
}
/// <summary>Verifies that a configuration with no native alarm sources keeps its baseline hash.</summary>
[Fact]
public void ComputeHash_NoNativeAlarmSources_HashUnchangedFromBaseline()
{
// TemplateEngine-011 migration surgicality: adding the (null-when-empty)
// Migration surgicality: adding the (null-when-empty)
// NativeAlarmSources property to the hashable projection must NOT change
// the hash of any native-source-free configuration. The literal below is
// the pre-migration hash of CreateConfig("Instance1", "25.0"); pinning it