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
@@ -26,7 +26,7 @@ using HealthPage = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Monitoring.H
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Pages;
/// <summary>
/// bUnit rendering tests for the Health Monitoring dashboard (Task 24).
/// bUnit rendering tests for the Health Monitoring dashboard.
///
/// Scope: the Notification Outbox KPI tile row added to the Health dashboard.
/// <see cref="ICentralHealthAggregator"/> is an interface (mockable), but
@@ -45,13 +45,14 @@ public class HealthPageTests : BunitContext
new("k", true, null, QueueDepth: 12, StuckCount: 4, ParkedCount: 3,
DeliveredLastInterval: 88, OldestPendingAge: TimeSpan.FromMinutes(6));
// Site Call Audit (#22) Task 7 — mutable scripted Site Call KPI reply. Tests
// Mutable scripted Site Call KPI reply. Tests
// that target the Site Call tiles override this before rendering.
private SiteCallKpiResponse _siteCallKpiReply =
new("k", true, null, BufferedCount: 9, ParkedCount: 2, FailedLastInterval: 1,
DeliveredLastInterval: 40, OldestPendingAge: TimeSpan.FromMinutes(3),
StuckCount: 5);
/// <summary>Initializes the test context and registers the services and actor stand-ins the Health page requires.</summary>
public HealthPageTests()
{
_comms = new CommunicationService(
@@ -65,7 +66,7 @@ public class HealthPageTests : BunitContext
_comms.SetSiteCallAudit(siteCallAudit);
Services.AddSingleton(_comms);
// arch-review WP2.4 — the page no longer queries CommunicationService /
// The page no longer queries CommunicationService /
// IAuditLogQueryService per circuit; it reads the process-level memoized
// KPI cache. The real cache is registered here (not a substitute) so the
// scripted-actor seam above is still what actually answers.
@@ -78,7 +79,7 @@ public class HealthPageTests : BunitContext
.Returns(new Dictionary<string, SiteHealthState>());
Services.AddSingleton(aggregator);
// M6 K16 — the Health page now injects IKpiHistoryQueryService to feed the
// The Health page now injects IKpiHistoryQueryService to feed the
// per-site Site Health Trends panel. Stub it with a known non-empty series
// so the page resolves the dependency and the trend charts have data; the
// dedicated trend tests below seed sites / override behaviour.
@@ -94,12 +95,12 @@ public class HealthPageTests : BunitContext
.Returns(Task.FromResult<IReadOnlyList<Site>>(new List<Site>()));
Services.AddSingleton(siteRepo);
// PLAN-01 Task 14 — the Health page now shows the metrics-stale badge with
// The Health page now shows the metrics-stale badge with
// a tooltip naming the configured MetricsStaleTimeout, so it injects the
// health-monitoring options.
Services.AddSingleton(Options.Create(new HealthMonitoringOptions()));
// Audit Log (#23) M7 Bundle E — the Health page now also fetches the
// The Health page now also fetches the
// Audit KPI snapshot. Stub it with an empty point-in-time reading so
// the existing assertions (Notification Outbox tiles, Online/Offline
// counts) keep passing; tests that target the Audit tiles set their
@@ -125,7 +126,7 @@ public class HealthPageTests : BunitContext
// policy is evaluated; force the real one (same note as NavMenuTests).
Services.AddSingleton<IAuthorizationService, DefaultAuthorizationService>();
// The cluster cards embed CentralFailoverControl (Task 10), which injects these two.
// The cluster cards embed CentralFailoverControl, which injects these two.
// The page's DI graph genuinely requires them in production, so the test supplies
// them rather than the component making its dependencies optional. Behaviour of the
// control itself is covered by HealthFailoverButtonTests.
@@ -136,7 +137,7 @@ public class HealthPageTests : BunitContext
/// <summary>
/// Renders the dashboard the way the app does — inside a
/// <see cref="CascadingAuthenticationState"/>, which the real layout supplies. The
/// cluster cards contain an AuthorizeView (the Task 10 failover control), and
/// cluster cards contain an AuthorizeView (the failover control), and
/// AuthorizeView throws without that cascading value.
/// </summary>
private IRenderedComponent<HealthPage> RenderHealthPage()
@@ -151,6 +152,7 @@ public class HealthPageTests : BunitContext
return host.FindComponent<HealthPage>();
}
/// <summary>Verifies that the Notification Outbox KPI tiles render with the supplied values.</summary>
[Fact]
public void Renders_OutboxKpiTiles_WithValues()
{
@@ -170,6 +172,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the dashboard renders a link to the notification KPIs page.</summary>
[Fact]
public void RendersLinkToTheNotificationKpisPage()
{
@@ -178,6 +181,7 @@ public class HealthPageTests : BunitContext
Assert.Contains("View details", link.TextContent);
}
/// <summary>Verifies that the audit KPI tiles render with the supplied values.</summary>
[Fact]
public void Renders_AuditKpiTiles_WithValues()
{
@@ -207,6 +211,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the Site Call KPI tiles render with the supplied values.</summary>
[Fact]
public void Renders_SiteCallKpiTiles_WithValues()
{
@@ -227,6 +232,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the dashboard renders a link to the Site Calls report page.</summary>
[Fact]
public void RendersLinkToTheSiteCallsReportPage()
{
@@ -235,6 +241,7 @@ public class HealthPageTests : BunitContext
Assert.Contains("View details", link.TextContent);
}
/// <summary>Verifies that a Site Call KPI failure shows a graceful fallback.</summary>
[Fact]
public void SiteCallKpiFailure_ShowsGracefulFallback()
{
@@ -254,6 +261,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that a Notification Outbox KPI failure shows a graceful fallback.</summary>
[Fact]
public void OutboxKpiFailure_ShowsGracefulFallback()
{
@@ -271,6 +279,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the site health trends panel and chart render for the selected site.</summary>
[Fact]
public void Renders_SiteHealthTrends_PanelAndChart_ForSelectedSite()
{
@@ -297,6 +306,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that a site health trends failure does not break the dashboard.</summary>
[Fact]
public void SiteHealthTrendsFailure_DoesNotBreakDashboard()
{
@@ -324,10 +334,11 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the metrics-stale badge renders for an online site whose metrics are stale.</summary>
[Fact]
public void Renders_MetricsStaleBadge_ForOnlineButStaleSite()
{
// PLAN-01 Task 14: a site that is online (heartbeating) but whose report
// A site that is online (heartbeating) but whose report
// pipeline died shows a distinct "Metrics stale" warning badge.
SeedStates(new SiteHealthState
{
@@ -352,6 +363,7 @@ public class HealthPageTests : BunitContext
// Sustained LocalDb replication backlog badge (register row 33)
// ------------------------------------------------------------------
/// <summary>Verifies that the replication backlog badge renders when the backlog is sustained past the dwell.</summary>
[Fact]
public void Renders_ReplicationBacklogBadge_WhenBacklogSustainedPastTheDwell()
{
@@ -373,6 +385,7 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that the replication backlog badge is not rendered during a purge burst.</summary>
[Fact]
public void DoesNotRender_ReplicationBacklogBadge_DuringAPurgeBurst()
{
@@ -394,6 +407,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"localdb-backlog-badge\"", cut.Markup);
}
/// <summary>Verifies that the replication backlog badge is not rendered for an unreplicated site.</summary>
[Fact]
public void DoesNotRender_ReplicationBacklogBadge_ForAnUnreplicatedSite()
{
@@ -413,6 +427,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"localdb-backlog-badge\"", cut.Markup);
}
/// <summary>Verifies that the replication backlog badge is not rendered for an offline site.</summary>
[Fact]
public void DoesNotRender_ReplicationBacklogBadge_ForAnOfflineSite()
{
@@ -432,6 +447,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"localdb-backlog-badge\"", cut.Markup);
}
/// <summary>Verifies that the LocalDb backlog trend chart renders.</summary>
[Fact]
public void Renders_LocalDbBacklogTrendChart()
{
@@ -448,9 +464,10 @@ public class HealthPageTests : BunitContext
// ----- Register row 73: the "No self-heal" badge -----------------------------------
//
// Tri-state, and only the explicit false is badged. Null means "not reported" — the
// central self-report row, and every site node on a pre-row-73 build — so badging null
// central self-report row, and every site node on an older build — so badging null
// would light up the whole fleet the moment central is upgraded ahead of the sites.
/// <summary>Verifies that the startup reconciler badge renders when the site reports it is missing.</summary>
[Fact]
public void Renders_StartupReconcilerBadge_WhenTheSiteReportsItIsMissing()
{
@@ -468,6 +485,7 @@ public class HealthPageTests : BunitContext
Assert.Contains("data-test=\"startup-reconciler-badge\"", cut.Markup));
}
/// <summary>Verifies that the startup reconciler badge is not rendered when the reconciler is running.</summary>
[Fact]
public void DoesNotRender_StartupReconcilerBadge_WhenTheReconcilerIsRunning()
{
@@ -485,6 +503,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"startup-reconciler-badge\"", cut.Markup);
}
/// <summary>Verifies that the startup reconciler badge is not rendered when the status is not reported.</summary>
[Fact]
public void DoesNotRender_StartupReconcilerBadge_WhenNotReported()
{
@@ -504,6 +523,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"startup-reconciler-badge\"", cut.Markup);
}
/// <summary>Verifies that the startup reconciler badge is not rendered when the site has no report yet.</summary>
[Fact]
public void DoesNotRender_StartupReconcilerBadge_WhenTheSiteHasNoReportYet()
{
@@ -521,6 +541,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"startup-reconciler-badge\"", cut.Markup);
}
/// <summary>Verifies that the startup reconciler badge is not rendered for an offline site.</summary>
[Fact]
public void DoesNotRender_StartupReconcilerBadge_ForAnOfflineSite()
{
@@ -559,11 +580,12 @@ public class HealthPageTests : BunitContext
StartupReconcilerActive = active,
};
// ----- Review finding M1: per-node deployed-secrets mirror failures ------------------
// ----- Per-node deployed-secrets mirror failures ------------------
//
// The standby's failures ride the active node's report; the card must name the node,
// the secret and the message. Null ("no data") and all-healthy nodes render nothing.
/// <summary>Verifies that secret mirror failures render labelled by node.</summary>
[Fact]
public void Renders_SecretMirrorFailures_LabelledByNode()
{
@@ -598,8 +620,10 @@ public class HealthPageTests : BunitContext
});
}
/// <summary>Verifies that no secret mirror warning renders when no node is failing.</summary>
/// <param name="reported">Whether the site reports secret mirror status at all.</param>
[Theory]
[InlineData(false)] // null = "no data" (central self-report, pre-M1 site)
[InlineData(false)] // null = "no data" (central self-report, older site)
[InlineData(true)] // every node healthy
public void DoesNotRender_SecretMirrorWarning_WhenNoNodeIsFailing(bool reported)
{
@@ -623,6 +647,7 @@ public class HealthPageTests : BunitContext
Assert.DoesNotContain("data-test=\"secret-mirror-failures\"", cut.Markup);
}
/// <summary>Verifies that the offline-since time renders for an offline site with a status change.</summary>
[Fact]
public void Renders_OfflineSince_ForOfflineSiteWithStatusChange()
{
@@ -688,6 +713,7 @@ public class HealthPageTests : BunitContext
};
}
/// <inheritdoc />
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -703,6 +729,8 @@ public class HealthPageTests : BunitContext
/// </summary>
private sealed class ScriptedOutboxActor : ReceiveActor
{
/// <summary>Initializes the actor with the test whose scripted reply it returns.</summary>
/// <param name="test">The owning test that holds the scripted reply.</param>
public ScriptedOutboxActor(HealthPageTests test)
{
Receive<NotificationKpiRequest>(_ => Sender.Tell(test._kpiReply));
@@ -712,11 +740,13 @@ public class HealthPageTests : BunitContext
/// <summary>
/// Stand-in for the Site Call Audit actor. Replies to the KPI request with
/// the test's currently-scripted response. Also handles the per-node KPI
/// request (T6: M5.2) with an empty-nodes success reply so the Health page
/// request with an empty-nodes success reply so the Health page
/// can complete initialization without a 30-second Ask timeout.
/// </summary>
private sealed class ScriptedSiteCallAuditActor : ReceiveActor
{
/// <summary>Initializes the actor with the test whose scripted replies it returns.</summary>
/// <param name="test">The owning test that holds the scripted replies.</param>
public ScriptedSiteCallAuditActor(HealthPageTests test)
{
Receive<SiteCallKpiRequest>(_ => Sender.Tell(test._siteCallKpiReply));