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
@@ -12,7 +12,7 @@ using ZB.MOM.WW.ScadaBridge.Communication;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Services;
/// <summary>
/// Unit tests for <see cref="SharedAlarmSummaryService"/> (arch-review WP2.4). The Alarm
/// Unit tests for <see cref="SharedAlarmSummaryService"/>. The Alarm
/// Summary page polls per circuit; the shared façade must collapse those into ONE per-site
/// fan-out per freshness window, and must widen that window while the live alarm cache is
/// serving the site (where the poll only still supplies the not-reporting list).
@@ -32,6 +32,7 @@ public class SharedAlarmSummaryServiceTests : IDisposable
private DateTimeOffset _now = T0;
/// <summary>Initializes a new instance of the <see cref="SharedAlarmSummaryServiceTests"/> class.</summary>
public SharedAlarmSummaryServiceTests()
{
_siteRepo.GetSiteByIdAsync(SiteId, Arg.Any<CancellationToken>())
@@ -59,6 +60,8 @@ public class SharedAlarmSummaryServiceTests : IDisposable
private SharedAlarmSummaryService CreateSut() =>
new(_provider.GetRequiredService<IServiceScopeFactory>(), _liveCache, () => _now);
/// <summary>Verifies that concurrent circuits share a single fan-out.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ConcurrentCircuits_ShareOneFanOut()
{
@@ -70,6 +73,8 @@ public class SharedAlarmSummaryServiceTests : IDisposable
Assert.All(results, r => Assert.Single(r.Alarms));
}
/// <summary>Verifies that a cold live cache refreshes within the page tick.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ColdLiveCache_RefreshesWithinThePageTick()
{
@@ -85,12 +90,14 @@ public class SharedAlarmSummaryServiceTests : IDisposable
await _instanceRepo.Received(2).GetInstancesBySiteIdAsync(SiteId, Arg.Any<CancellationToken>());
}
/// <summary>Verifies that serving from the live cache skips the fan-out entirely.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LiveCacheServing_SkipsTheFanOutEntirely()
{
// The aggregator's seed/reconcile already ran this exact fan-out and publishes both
// halves of the answer, so the façade must not run a second one — not now, not after
// any elapsed window (arch-review phase-2 residual #4).
// any elapsed window.
var sut = CreateSut();
_liveCache.Live = true;
_liveCache.NotReporting = new[] { "inst-silent" };
@@ -116,6 +123,8 @@ public class SharedAlarmSummaryServiceTests : IDisposable
}
}
/// <summary>Verifies that when the live cache goes cold the service falls back to the fan-out.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LiveCacheGoingCold_FallsBackToTheFanOut()
{
@@ -133,6 +142,8 @@ public class SharedAlarmSummaryServiceTests : IDisposable
Assert.Single(result.Alarms);
}
/// <summary>Verifies that different sites do not share a memo slot.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DifferentSites_DoNotShareAMemoSlot()
{
@@ -151,6 +162,7 @@ public class SharedAlarmSummaryServiceTests : IDisposable
await _instanceRepo.Received(1).GetInstancesBySiteIdAsync(otherSite, Arg.Any<CancellationToken>());
}
/// <summary>Verifies that the pure methods return the same results as the direct implementation.</summary>
[Fact]
public void PureMethods_MatchTheDirectImplementation()
{
@@ -176,6 +188,7 @@ public class SharedAlarmSummaryServiceTests : IDisposable
Assert.Equal(expectedRollup.CountsByKind, sharedRollup.CountsByKind);
}
/// <summary>Releases the resources held by this test class.</summary>
public void Dispose() => _provider.Dispose();
/// <summary>
@@ -184,20 +197,28 @@ public class SharedAlarmSummaryServiceTests : IDisposable
/// </summary>
private sealed class FakeLiveCache : ISiteAlarmLiveCache
{
/// <summary>Gets or sets whether the fake cache reports the site as live.</summary>
public bool Live { get; set; }
/// <summary>Gets or sets the alarms returned as the site's current alarms.</summary>
public IReadOnlyList<AlarmStateChanged> Current { get; set; } = Array.Empty<AlarmStateChanged>();
/// <summary>Gets or sets the instances returned as not reporting.</summary>
public IReadOnlyList<string> NotReporting { get; set; } = Array.Empty<string>();
/// <inheritdoc />
public IDisposable Subscribe(int siteId, Action onChanged) => new NoOp();
/// <inheritdoc />
public IReadOnlyList<AlarmStateChanged> GetCurrentAlarms(int siteId) => Current;
/// <inheritdoc />
public bool IsLive(int siteId) => Live;
/// <inheritdoc />
public IReadOnlyList<string> GetNotReportingInstances(int siteId) => NotReporting;
private sealed class NoOp : IDisposable
{
/// <summary>Does nothing; the no-op subscription holds no resources.</summary>
public void Dispose() { }
}
}