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
@@ -35,6 +35,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests;
/// </summary>
public class TopologyPageTests : BunitContext
{
/// <summary>Verifies that the storage-save fixture completes the JavaScript invocation immediately.</summary>
[Fact]
public void StorageSaveFixture_CompletesInvocationImmediately()
{
@@ -48,6 +49,7 @@ public class TopologyPageTests : BunitContext
private readonly IFlatteningPipeline _pipeline = Substitute.For<IFlatteningPipeline>();
private readonly IAuditService _audit = Substitute.For<IAuditService>();
/// <summary>Initializes the test class with substituted repositories and the services the Topology page depends on.</summary>
public TopologyPageTests()
{
Services.AddSingleton(_repo);
@@ -67,7 +69,7 @@ public class TopologyPageTests : BunitContext
{
OperationLockTimeout = TimeSpan.FromSeconds(5)
}));
// Notify-and-fetch (Task 6): DeploymentService now also depends on
// Notify-and-fetch: DeploymentService now also depends on
// IOptions<CommunicationOptions>; register it so the page's DI graph resolves.
Services.AddSingleton(Options.Create(new CommunicationOptions()));
Services.AddSingleton<ILogger<DeploymentService>>(NullLogger<DeploymentService>.Instance);
@@ -78,12 +80,12 @@ public class TopologyPageTests : BunitContext
// from the (List-normalized) snapshot via RevisionHashService; register it
// so the page's DI graph resolves.
Services.AddScoped<ZB.MOM.WW.ScadaBridge.TemplateEngine.Flattening.RevisionHashService>();
// CentralUI-006: DeploymentService now also depends on the
// DeploymentService now also depends on the
// deployment-status notifier (a process singleton in production).
Services.AddSingleton<ZB.MOM.WW.ScadaBridge.DeploymentManager.IDeploymentStatusNotifier>(
new ZB.MOM.WW.ScadaBridge.DeploymentManager.DeploymentStatusNotifier(
NullLogger<ZB.MOM.WW.ScadaBridge.DeploymentManager.DeploymentStatusNotifier>.Instance));
// P7-6: the bulk site deploy's up-to-date pre-filter asks the staleness
// The bulk site deploy's up-to-date pre-filter asks the staleness
// probe for each instance's current revision hash, so DeploymentService now
// depends on it too. The page under test never bulk-deploys; a substitute
// keeps the DI graph resolvable without dragging in the flattening stack.
@@ -99,7 +101,7 @@ public class TopologyPageTests : BunitContext
// DI registration still has to satisfy the [Inject].
Services.AddScoped<IDialogService, DialogService>();
// Site scoping (CentralUI-002): Topology injects SiteScopeService to
// Site scoping: Topology injects SiteScopeService to
// filter the tree by the user's permitted sites.
Services.AddScoped<ZB.MOM.WW.ScadaBridge.CentralUI.Auth.SiteScopeService>();
@@ -164,6 +166,9 @@ public class TopologyPageTests : BunitContext
return cut;
}
/// <summary>Verifies that branch loads and refreshes serialize repository reads without dropping the user-selected page.</summary>
/// <param name="branchFirst">Whether the branch is loaded before the refresh starts.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
[Theory]
[InlineData(true)]
[InlineData(false)]
@@ -209,6 +214,8 @@ public class TopologyPageTests : BunitContext
Assert.Equal(51, Assert.Single((List<Instance>)field.GetValue(cut.Instance)!).Id);
}
/// <summary>Verifies that branch pages are loaded lazily and each replaces the previous page.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task BranchPages_AreLazyAndReplacePreviousPage()
{
@@ -225,6 +232,7 @@ public class TopologyPageTests : BunitContext
await _repo.DidNotReceive().GetAllInstancesAsync(Arg.Any<CancellationToken>());
}
/// <summary>Verifies that the initial load does not read instances or templates.</summary>
[Fact]
public void InitialLoad_DoesNotReadInstancesOrTemplates()
{
@@ -236,6 +244,9 @@ public class TopologyPageTests : BunitContext
_repo.DidNotReceive().GetAllTemplatesAsync(Arg.Any<CancellationToken>());
}
/// <summary>Verifies that moving an existing topology item uses the current site scope.</summary>
/// <param name="revoked">Whether the user's site permission has been revoked.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
[Theory]
[InlineData(false)]
[InlineData(true)]
@@ -257,6 +268,9 @@ public class TopologyPageTests : BunitContext
Assert.Equal(revoked ? 10 : (int?)null, instance.AreaId);
}
/// <summary>Verifies that creating an item under an existing topology uses the current site scope.</summary>
/// <param name="revoked">Whether the user's site permission has been revoked.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
[Theory]
[InlineData(false)]
[InlineData(true)]
@@ -275,6 +289,7 @@ public class TopologyPageTests : BunitContext
await _repo.Received(revoked ? 0 : 1).AddAreaAsync(Arg.Any<Area>(), Arg.Any<CancellationToken>());
}
/// <summary>Verifies that an empty state is rendered when there are no sites.</summary>
[Fact]
public void Renders_EmptyState_WhenNoSites()
{
@@ -285,6 +300,7 @@ public class TopologyPageTests : BunitContext
Assert.Contains("No sites configured", cut.Markup);
}
/// <summary>Verifies that an empty site is rendered as a top-level node.</summary>
[Fact]
public void Renders_EmptySite_AsTopLevelNode()
{
@@ -303,6 +319,7 @@ public class TopologyPageTests : BunitContext
.FirstOrDefault(row => row.QuerySelector(".tv-label")?.TextContent == label)
?.QuerySelector(".tv-toggle");
/// <summary>Verifies that sites, areas and instances render in nested order.</summary>
[Fact]
public void Renders_SiteAreaInstance_Nesting()
{
@@ -335,6 +352,7 @@ public class TopologyPageTests : BunitContext
Assert.Contains("NotDeployed", cut.Markup);
}
/// <summary>Verifies that search dims non-matching nodes while preserving the tree shape.</summary>
[Fact]
public void Search_DimsNonMatches_PreservesShape()
{
@@ -363,10 +381,11 @@ public class TopologyPageTests : BunitContext
Assert.Contains(dimmedNodes, n => n.TextContent.Contains("Boilers"));
}
/// <summary>Verifies that a deployment user scoped to specific sites sees only the permitted sites.</summary>
[Fact]
public void SiteScoping_ScopedDeploymentUser_OnlySeesPermittedSites()
{
// Regression test for CentralUI-002. The SiteId claims issued at login were
// Regression test . The SiteId claims issued at login were
// never read, so a Deployment user scoped to one site could view (and act
// on) every site's topology. Topology now filters the tree by the user's
// permitted sites via SiteScopeService.
@@ -393,6 +412,7 @@ public class TopologyPageTests : BunitContext
Assert.DoesNotContain("Plant-B", cut.Markup);
}
/// <summary>Verifies that a system-wide deployment user sees all sites.</summary>
[Fact]
public void SiteScoping_SystemWideDeploymentUser_SeesAllSites()
{
@@ -409,6 +429,7 @@ public class TopologyPageTests : BunitContext
Assert.Contains("Plant-B", cut.Markup);
}
/// <summary>Verifies that double-clicking an area label enters rename mode.</summary>
[Fact]
public void DoubleClick_OnAreaLabel_EntersRenameMode()
{
@@ -428,6 +449,7 @@ public class TopologyPageTests : BunitContext
Assert.NotNull(cut.Find("input.form-control-sm.d-inline-block"));
}
/// <summary>Verifies that instance rows do not support double-click rename.</summary>
[Fact]
public void InstanceRows_DoNotHaveDoubleClickRename()
{
@@ -448,10 +470,11 @@ public class TopologyPageTests : BunitContext
Assert.Throws<Bunit.MissingEventHandlerException>(() => instanceLabel.DoubleClick());
}
/// <summary>Verifies that a connection endpoint change renders a connection section in the diff.</summary>
[Fact]
public void Diff_ConnectionEndpointChange_RendersConnectionSection()
{
// TemplateEngine-018 / DeploymentManager-018: a standalone connection
// A standalone connection
// endpoint edit (no per-attribute binding change) must surface in the
// deployment-diff modal. Before ConnectionChanges was wired through
// ComputeDiff + the UI, this redeploy showed only the stale-hash badge
@@ -560,6 +583,8 @@ public class TopologyPageTests : BunitContext
new FlatteningPipelineResult(currentConfig, "hash-new", ValidationResult.Success()))));
}
/// <summary>Verifies that a live update does not recompute staleness.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LiveUpdate_DoesNotRecomputeStaleness()
{
@@ -585,6 +610,7 @@ public class TopologyPageTests : BunitContext
.GetDeployedSnapshotByInstanceIdAsync(100, Arg.Any<CancellationToken>());
}
/// <summary>Verifies that the deployed state renders after the split.</summary>
[Fact]
public void DeployedState_Renders_AfterSplit()
{
@@ -601,6 +627,7 @@ public class TopologyPageTests : BunitContext
Assert.Matches("Stale|Current", cut.Markup);
}
/// <summary>Verifies that a manual re-check recomputes staleness.</summary>
[Fact]
public void ManualRecheck_RecomputesStaleness()
{
@@ -619,6 +646,7 @@ public class TopologyPageTests : BunitContext
.GetDeployedSnapshotByInstanceIdAsync(100, Arg.Any<CancellationToken>());
}
/// <summary>Verifies that the legacy instances route is declared on the Topology page.</summary>
[Fact]
public void LegacyInstancesRoute_IsDeclaredOnTopologyPage()
{