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:
@@ -29,6 +29,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
private readonly ISiteRepository _siteRepo = Substitute.For<ISiteRepository>();
|
||||
private readonly FakeSiteAlarmLiveCache _liveCache = new();
|
||||
|
||||
/// <summary>Initializes the test class and configures the faked services and the bUnit context.</summary>
|
||||
public AlarmSummaryRenderTests()
|
||||
{
|
||||
// Two rows whose default sort (severity DESC) orders Zeta (900) before
|
||||
@@ -41,7 +42,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
|
||||
_summary.GetSiteAlarmsAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Task.FromResult(new AlarmSummaryResult(rows, Array.Empty<string>())));
|
||||
// BuildFromLiveAlarms (Task 5): flatten the pushed live snapshot the same way
|
||||
// BuildFromLiveAlarms: flatten the pushed live snapshot the same way
|
||||
// the real service does, so the live-path render tests exercise real behavior.
|
||||
_summary.BuildFromLiveAlarms(Arg.Any<IReadOnlyList<AlarmStateChanged>>())
|
||||
.Returns(ci =>
|
||||
@@ -90,6 +91,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
return cut;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that sortable headers carry a tabindex and an aria-sort attribute.</summary>
|
||||
[Fact]
|
||||
public void SortableHeaders_CarryTabindexAndAriaSort()
|
||||
{
|
||||
@@ -113,6 +115,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.Null(stateKind.GetAttribute("aria-sort"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Enter on the instance header flips the row order.</summary>
|
||||
[Fact]
|
||||
public void EnterOnInstanceHeader_FlipsRowOrder()
|
||||
{
|
||||
@@ -133,8 +136,9 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
cut.FindAll("tr[data-test='alarm-summary-row']")[0]
|
||||
.QuerySelector("td")!.TextContent.Trim();
|
||||
|
||||
// ── plan #10 Task 5: live-cache-first with poll fallback ───────────────────
|
||||
// ── live-cache-first with poll fallback ───────────────────
|
||||
|
||||
/// <summary>Verifies that selecting a site subscribes to the live cache.</summary>
|
||||
[Fact]
|
||||
public void SelectingSite_SubscribesToTheLiveCache()
|
||||
{
|
||||
@@ -144,6 +148,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.Equal(1, _liveCache.LastSubscribedSite);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the poll fallback renders when the live cache is not live yet.</summary>
|
||||
[Fact]
|
||||
public void PollFallbackRenders_WhenCacheNotLiveYet()
|
||||
{
|
||||
@@ -157,6 +162,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.Equal("Zeta", FirstRowInstance(cut)); // severity-desc default
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a change notification rebuilds the rendered rows from the live snapshot.</summary>
|
||||
[Fact]
|
||||
public void OnChangedDelta_RebuildsRenderedRowsFromLiveSnapshot()
|
||||
{
|
||||
@@ -176,6 +182,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that leaving a site unsubscribes from the live cache.</summary>
|
||||
[Fact]
|
||||
public void LeavingSite_UnsubscribesFromTheLiveCache()
|
||||
{
|
||||
@@ -188,6 +195,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.Equal(1, _liveCache.DisposeCount);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that changing the site resubscribes to the new site.</summary>
|
||||
[Fact]
|
||||
public void ChangingSite_ResubscribesToTheNewSite()
|
||||
{
|
||||
@@ -200,6 +208,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.Equal(2, _liveCache.LastSubscribedSite);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that disposing the component unsubscribes from the live cache.</summary>
|
||||
[Fact]
|
||||
public void DisposingComponent_UnsubscribesFromTheLiveCache()
|
||||
{
|
||||
@@ -212,6 +221,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
|
||||
// ── arch-review R2 N4: stale-site poll guard ───────────────────────────────
|
||||
|
||||
/// <summary>Verifies that an in-flight poll for the previous site does not overwrite the new site's rows.</summary>
|
||||
[Fact]
|
||||
public void InFlightPollForPreviousSite_DoesNotOverwriteNewSitesRows()
|
||||
{
|
||||
@@ -231,7 +241,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
cut.Find("[data-test='alarm-summary-site']").Change("2"); // site 2 renders
|
||||
cut.WaitForAssertion(() => Assert.Equal("Site2Instance", FirstRowInstance(cut)));
|
||||
|
||||
// The stale site-1 fan-out now completes — it must be dropped, not rendered.
|
||||
// The stale first-site fan-out now completes — it must be dropped, not rendered.
|
||||
site1Tcs.SetResult(new AlarmSummaryResult(
|
||||
new List<AlarmSummaryRow>
|
||||
{
|
||||
@@ -248,6 +258,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
|
||||
// ── arch-review R2 N5: while live, the poll updates only _notReporting ──────
|
||||
|
||||
/// <summary>Verifies that a poll while live updates only the not-reporting list and does not regress the live rows.</summary>
|
||||
[Fact]
|
||||
public void PollWhileLive_UpdatesNotReportingOnly_DoesNotRegressLiveRows()
|
||||
{
|
||||
@@ -280,9 +291,10 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
// ── arch-review P6-2: site scoping (a scoped Deployer must not watch another
|
||||
// ── site scoping (a scoped Deployer must not watch another
|
||||
// site's live alarms — the page was missed by the ad0100f2 scoping survey) ──
|
||||
|
||||
/// <summary>Verifies that a site-scoped deployment user sees only the permitted site in the picker.</summary>
|
||||
[Fact]
|
||||
public void SiteScoping_ScopedDeploymentUser_SeesOnlyPermittedSiteInPicker()
|
||||
{
|
||||
@@ -302,6 +314,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
Assert.DoesNotContain("Site 2", cut.Markup);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a forged out-of-scope site id is denied and never fetched.</summary>
|
||||
[Fact]
|
||||
public void SiteScoping_ForgedOutOfScopeSiteId_IsDeniedNotFetched()
|
||||
{
|
||||
@@ -329,6 +342,7 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
|
||||
// ── arch-review R2 N7: disposal guard on the live callback ─────────────────
|
||||
|
||||
/// <summary>Verifies that a live callback racing with disposal is dropped without a rebuild or an exception.</summary>
|
||||
[Fact]
|
||||
public void LiveCallbackRacingDispose_IsDropped_NoRebuildNoThrow()
|
||||
{
|
||||
@@ -363,11 +377,16 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
private IReadOnlyList<AlarmStateChanged> _current = Array.Empty<AlarmStateChanged>();
|
||||
private bool _live;
|
||||
|
||||
/// <summary>Gets the number of subscribe calls received.</summary>
|
||||
public int SubscribeCount { get; private set; }
|
||||
/// <summary>Gets the number of subscriptions disposed.</summary>
|
||||
public int DisposeCount { get; private set; }
|
||||
/// <summary>Gets the site id of the most recent subscribe call.</summary>
|
||||
public int? LastSubscribedSite { get; private set; }
|
||||
/// <summary>Gets the change callback captured by the most recent subscribe call.</summary>
|
||||
public Action? CapturedCallback => _onChanged;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IDisposable Subscribe(int siteId, Action onChanged)
|
||||
{
|
||||
SubscribeCount++;
|
||||
@@ -376,8 +395,10 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
return new Subscription(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<AlarmStateChanged> GetCurrentAlarms(int siteId) => _current;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsLive(int siteId) => _live;
|
||||
|
||||
/// <summary>
|
||||
@@ -386,8 +407,11 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> NotReporting { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<string> GetNotReportingInstances(int siteId) => NotReporting;
|
||||
|
||||
/// <summary>Replaces the current snapshot, marks the cache live and raises the change callback.</summary>
|
||||
/// <param name="alarms">The alarm snapshot to publish.</param>
|
||||
public void PushAlarms(IReadOnlyList<AlarmStateChanged> alarms)
|
||||
{
|
||||
_current = alarms;
|
||||
@@ -400,8 +424,11 @@ public class AlarmSummaryRenderTests : BunitContext
|
||||
private readonly FakeSiteAlarmLiveCache _owner;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>Initializes the subscription for the given fake cache.</summary>
|
||||
/// <param name="owner">The fake cache that issued the subscription.</param>
|
||||
public Subscription(FakeSiteAlarmLiveCache owner) => _owner = owner;
|
||||
|
||||
/// <summary>Releases the resources held by this instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
||||
Reference in New Issue
Block a user