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
@@ -22,7 +22,7 @@ using SiteCallsReportPage = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Sit
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Pages;
/// <summary>
/// bUnit rendering tests for the Site Calls report page (Site Call Audit #22).
/// bUnit rendering tests for the Site Calls report page.
///
/// Testability note: <see cref="CommunicationService"/> is a concrete class with
/// non-virtual methods, so NSubstitute cannot intercept it. The page's calls all
@@ -82,6 +82,7 @@ public class SiteCallsReportPageTests : BunitContext
private DiscardSiteCallResponse _discardReply =
new("q", SiteCallRelayOutcome.Applied, true, true, null);
/// <summary>Initializes the bUnit context with the fakes and services the Site Calls report page depends on.</summary>
public SiteCallsReportPageTests()
{
_comms = new CommunicationService(
@@ -129,6 +130,7 @@ public class SiteCallsReportPageTests : BunitContext
Services.AddScoped<ZB.MOM.WW.ScadaBridge.CentralUI.Auth.SiteScopeService>();
}
/// <summary>Verifies that the page requires the Deployment authorization policy.</summary>
[Fact]
public void Page_RequiresDeploymentPolicy()
{
@@ -141,6 +143,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.Equal(AuthorizationPolicies.RequireDeployment, attr!.Policy);
}
/// <summary>Verifies that the page renders a row for each site call returned by the query.</summary>
[Fact]
public void Renders_SiteCallRows()
{
@@ -153,6 +156,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that a stuck row is shown with a stuck badge.</summary>
[Fact]
public void StuckRow_IsBadged()
{
@@ -167,6 +171,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that the Retry and Discard buttons are shown only on parked rows.</summary>
[Fact]
public void RetryDiscardButtons_ShownOnlyOnParkedRows()
{
@@ -192,6 +197,7 @@ public class SiteCallsReportPageTests : BunitContext
b => b.TextContent.Contains("Discard"));
}
/// <summary>Verifies that clicking Retry on a parked row relays the retry to the owning site.</summary>
[Fact]
public void ClickRetry_OnParkedRow_RelaysRetryToOwningSite()
{
@@ -215,6 +221,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that clicking Discard on a parked row relays the discard to the owning site.</summary>
[Fact]
public void ClickDiscard_OnParkedRow_RelaysDiscardToOwningSite()
{
@@ -237,6 +244,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that a retry relay to an unreachable site shows a distinct message.</summary>
[Fact]
public void RetryRelay_SiteUnreachable_ShowsDistinctMessage()
{
@@ -259,6 +267,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.Contains("offline", cut.Markup));
}
/// <summary>Verifies that a failed query shows an error message.</summary>
[Fact]
public void QueryFailure_ShowsErrorMessage()
{
@@ -277,6 +286,7 @@ public class SiteCallsReportPageTests : BunitContext
// /audit/log?correlationId={TrackedOperationId}.
// ─────────────────────────────────────────────────────────────────────────
/// <summary>Verifies that the View Audit History link on a row has the correct href.</summary>
[Fact]
public void SiteCallRow_ViewAuditHistory_Link_HasCorrectHref()
{
@@ -310,6 +320,7 @@ public class SiteCallsReportPageTests : BunitContext
// page numbers; the request echoes the cursor back to the actor.
// ─────────────────────────────────────────────────────────────────────────
/// <summary>Verifies that the Next button is hidden when there is no further page.</summary>
[Fact]
public void Paging_NextButton_HiddenWhenNoFurtherPage()
{
@@ -324,6 +335,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.True(prev.HasAttribute("disabled"));
}
/// <summary>Verifies that the Next button advances using the keyset cursor.</summary>
[Fact]
public void Paging_NextButton_AdvancesUsingKeysetCursor()
{
@@ -364,6 +376,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that the Previous button pops the back stack and refetches using the prior cursor.</summary>
[Fact]
public void Paging_PrevButton_PopsBackStackAndRefetchesPriorCursor()
{
@@ -407,7 +420,7 @@ public class SiteCallsReportPageTests : BunitContext
cut.WaitForAssertion(() =>
{
// Query 3 is the Previous refetch — the back-stack popped the page-1
// Query 3 is the Previous refetch — the back-stack popped the page 1
// cursor, which is the empty (null, null) first-page cursor.
Assert.Equal(3, _queryRequests.Count);
Assert.Null(_queryRequests[2].AfterCreatedAtUtc);
@@ -417,6 +430,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that retrying a row that is no longer parked shows an info message and exactly one toast.</summary>
[Fact]
public void RetryRelay_NotParked_ShowsInfoMessage_AndExactlyOneToast()
{
@@ -453,6 +467,7 @@ public class SiteCallsReportPageTests : BunitContext
// is already filtered, and the filter card controls must reflect the values.
// ─────────────────────────────────────────────────────────────────────────
/// <summary>Verifies that navigating with the parked status query parameter loads the grid pre-filtered to parked rows.</summary>
[Fact]
public void NavigateWithStatusParkedParam_LoadsGridPreFilteredToParked()
{
@@ -476,6 +491,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that navigating with the stuck query parameter set to true loads the grid with the stuck filter applied.</summary>
[Fact]
public void NavigateWithStuckTrueParam_LoadsGridWithStuckFilterApplied()
{
@@ -497,6 +513,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that navigating without query parameters loads the grid unfiltered.</summary>
[Fact]
public void NavigateWithNoQueryParams_LoadsGridUnfiltered()
{
@@ -521,9 +538,10 @@ public class SiteCallsReportPageTests : BunitContext
// Flow Debugger / Audit Log deep link: ?correlationId=<TrackedOperationId>
// seeds a read-only "Operation" pill filter, rides on the query as
// TrackedOperationIdFilter, and auto-opens the detail modal when exactly
// one matching row comes back (follow-ups plan D2 / Task 4).
// one matching row comes back.
// ─────────────────────────────────────────────────────────────────────────
/// <summary>Verifies that a correlation ID query parameter seeds the operation filter and automatically opens the detail view.</summary>
[Fact]
public void SiteCallsReport_CorrelationIdQuery_SeedsTheOperationFilterAndAutoOpensDetail()
{
@@ -558,6 +576,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that a correlation ID query parameter with no matching row does not open the detail view.</summary>
[Fact]
public void SiteCallsReport_CorrelationIdQuery_NoMatchingRow_DoesNotOpenDetail()
{
@@ -580,6 +599,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.Empty(_detailRequests);
}
/// <summary>Verifies that clearing the filters drops the operation filter.</summary>
[Fact]
public void ClearFilters_DropsTheOperationFilter()
{
@@ -597,6 +617,7 @@ public class SiteCallsReportPageTests : BunitContext
cut.WaitForAssertion(() => Assert.Empty(cut.FindAll("[data-test='site-calls-filter-operation']")));
}
/// <summary>Verifies that the operation pill's clear button drops the filter and requeries.</summary>
[Fact]
public void OperationPill_ClearButton_DropsTheFilterAndRequeries()
{
@@ -616,10 +637,11 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that a Deployment user scoped to one site does not see rows from out-of-scope sites.</summary>
[Fact]
public void SiteScoping_ScopedDeploymentUser_HidesOutOfScopeRows()
{
// CentralUI-028: a Deployment user scoped to Plant A only must not see
// A Deployment user scoped to Plant A only must not see
// Plant B rows in the grid, even though the query response carried both.
// Last AuthenticationStateProvider registration wins on resolution.
var scopedUser = new ClaimsPrincipal(new ClaimsIdentity(new[]
@@ -647,6 +669,7 @@ public class SiteCallsReportPageTests : BunitContext
// section is collapsed on init; expanding it lazy-loads the series.
// ─────────────────────────────────────────────────────────────────────────
/// <summary>Verifies that the trends section container always renders.</summary>
[Fact]
public void TrendsSection_Container_AlwaysRenders()
{
@@ -658,6 +681,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.NotNull(cut.Find("[data-test='site-calls-trends']")));
}
/// <summary>Verifies that an expanded trends section renders charts from the known series.</summary>
[Fact]
public void TrendsSection_WhenExpanded_RendersChartsFromKnownSeries()
{
@@ -680,6 +704,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <summary>Verifies that toggling the trends window reloads the series.</summary>
[Fact]
public void TrendsSection_WindowToggle_ReloadsSeries()
{
@@ -700,10 +725,11 @@ public class SiteCallsReportPageTests : BunitContext
Assert.True(_kpiHistory.ReceivedCalls().Count() > afterExpand));
}
/// <summary>Verifies that the long-range trend windows render and reload the series.</summary>
[Fact]
public void TrendsSection_LongRangeWindows_RenderAndReloadSeries()
{
// The 30d/90d buttons (plan #22 T7) render alongside 24h/7d and clicking
// The 30d/90d buttons render alongside 24h/7d and clicking
// one re-loads the series — the query service then routes the long window
// to hourly rollups transparently.
var cut = Render<SiteCallsReportPage>();
@@ -725,6 +751,7 @@ public class SiteCallsReportPageTests : BunitContext
Assert.True(_kpiHistory.ReceivedCalls().Count() > afterExpand));
}
/// <summary>Verifies that the page still renders when the KPI history query throws.</summary>
[Fact]
public void TrendsSection_WhenKpiHistoryThrows_PageStillRenders()
{
@@ -751,6 +778,7 @@ public class SiteCallsReportPageTests : BunitContext
});
}
/// <inheritdoc />
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -766,6 +794,8 @@ public class SiteCallsReportPageTests : BunitContext
/// </summary>
private sealed class ScriptedSiteCallAuditActor : ReceiveActor
{
/// <summary>Creates the stand-in actor, wiring each request type to the owning test's recorded requests and scripted replies.</summary>
/// <param name="test">The owning test whose recorded requests and scripted replies the actor uses.</param>
public ScriptedSiteCallAuditActor(SiteCallsReportPageTests test)
{
Receive<SiteCallQueryRequest>(r =>
@@ -794,19 +824,28 @@ public class SiteCallsReportPageTests : BunitContext
/// <summary>A dialog service that auto-confirms, so action paths run end-to-end.</summary>
private sealed class AlwaysConfirmDialogService : IDialogService
{
/// <inheritdoc />
public Task<bool> ConfirmAsync(string title, string message, bool danger = false, string? confirmLabel = null)
=> Task.FromResult(true);
// Register row 75 added a DialogSeverity overload. This stub auto-confirms
// regardless of severity — it exists to let action paths run end to end, not to
// assert anything about styling.
/// <inheritdoc />
public Task<bool> ConfirmAsync(string title, string message, DialogSeverity severity, string? confirmLabel = null)
=> Task.FromResult(true);
/// <inheritdoc />
public Task<string?> PromptAsync(
string title, string label, string initialValue = "", string? placeholder = null)
=> Task.FromResult<string?>(null);
/// <summary>Returns a null result without rendering the dialog.</summary>
/// <typeparam name="TResult">The dialog result type.</typeparam>
/// <param name="title">The dialog title, ignored.</param>
/// <param name="body">The dialog body fragment, ignored.</param>
/// <param name="size">The dialog size, ignored.</param>
/// <returns>A task that completes with a null result.</returns>
public Task<TResult?> ShowAsync<TResult>(
string title,
Microsoft.AspNetCore.Components.RenderFragment<DialogContext<TResult>> body,