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:
+9
-4
@@ -22,14 +22,14 @@ using TopologyPage = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Deployment
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Regression tests for register row 103 (the P6-6 lesser instance in
|
||||
/// Regression tests for register row 103 (the lesser instance in
|
||||
/// <c>Topology</c>). <c>OnInitializedAsync</c> awaits <c>LoadDataAsync</c> and only then
|
||||
/// calls <c>StartLiveUpdatesTimer</c>. If the circuit was torn down inside that await
|
||||
/// (user navigates away during the initial page load), the pre-fix <c>Dispose</c> would
|
||||
/// have already run and found <c>_liveUpdatesTimer</c> still null — a no-op — so the
|
||||
/// timer <c>StartLiveUpdatesTimer</c> creates once the await resumes is never disposed:
|
||||
/// it ticks against a torn-down component every 15s until process restart. The fix
|
||||
/// (mirroring <c>DebugView</c>'s P6-6 fix and <c>TransportImport</c>'s row-103 sibling
|
||||
/// (mirroring <c>DebugView</c>'s fix and <c>TransportImport</c>'s sibling
|
||||
/// fix) creates/replaces the timer and observes disposal atomically under
|
||||
/// <c>_timerLock</c>, so a (re)start that resumes after <c>Dispose</c> already ran
|
||||
/// refuses to create a new timer instead of leaking one.
|
||||
@@ -50,13 +50,14 @@ public class TopologyLiveUpdatesTimerDisposeRaceTests : BunitContext
|
||||
private readonly IDeploymentManagerRepository _deployRepo = Substitute.For<IDeploymentManagerRepository>();
|
||||
private readonly IAuditService _audit = Substitute.For<IAuditService>();
|
||||
|
||||
/// <summary>Initializes the test context and registers the services the Topology page requires.</summary>
|
||||
public TopologyLiveUpdatesTimerDisposeRaceTests()
|
||||
{
|
||||
Services.AddSingleton(_repo);
|
||||
Services.AddSingleton(_siteRepo);
|
||||
Services.AddSingleton(_deployRepo);
|
||||
Services.AddSingleton(Substitute.For<ZB.MOM.WW.ScadaBridge.DeploymentManager.IFlatteningPipeline>());
|
||||
// DeploymentService takes IStaleInstanceProbe since the Low-wave P7-6 pre-filter (T13).
|
||||
// DeploymentService takes IStaleInstanceProbe since the up-to-date pre-filter.
|
||||
Services.AddSingleton(Substitute.For<ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Transport.IStaleInstanceProbe>());
|
||||
Services.AddSingleton(_audit);
|
||||
|
||||
@@ -124,6 +125,7 @@ public class TopologyLiveUpdatesTimerDisposeRaceTests : BunitContext
|
||||
private static T? GetField<T>(object obj, string name) =>
|
||||
(T?)obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(obj);
|
||||
|
||||
/// <summary>Verifies that rendering the page starts a live updates timer, as a sanity check for the race tests.</summary>
|
||||
[Fact]
|
||||
public void Render_StartsALiveTimer_Sanity()
|
||||
{
|
||||
@@ -134,13 +136,14 @@ public class TopologyLiveUpdatesTimerDisposeRaceTests : BunitContext
|
||||
cut.Instance.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that resuming the live updates timer after dispose leaves no live timer.</summary>
|
||||
[Fact]
|
||||
public void StartLiveUpdatesTimer_ResumingAfterDispose_LeavesNoLiveTimer()
|
||||
{
|
||||
// Simulates: OnInitializedAsync is suspended awaiting LoadDataAsync; the user
|
||||
// navigates away, so Dispose() runs (and, since no timer exists yet, has nothing
|
||||
// to stop); the await then resumes and calls StartLiveUpdatesTimer() — the exact
|
||||
// shape register row 103 flags for Topology (the P6-6 lesser instance).
|
||||
// shape register row 103 flags for Topology (the lesser instance).
|
||||
var cut = Render<TopologyPage>();
|
||||
|
||||
// The normal init path already started a timer; dispose it first so the field is
|
||||
@@ -158,6 +161,7 @@ public class TopologyLiveUpdatesTimerDisposeRaceTests : BunitContext
|
||||
Assert.Null(GetField<Timer?>(cut.Instance, "_liveUpdatesTimer"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that disposing the page stops the live timer exactly once.</summary>
|
||||
[Fact]
|
||||
public void Dispose_StopsTheLiveTimer_ExactlyOnce()
|
||||
{
|
||||
@@ -174,6 +178,7 @@ public class TopologyLiveUpdatesTimerDisposeRaceTests : BunitContext
|
||||
Assert.Null(GetField<Timer?>(cut.Instance, "_liveUpdatesTimer"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that toggling live updates off and then disposing leaves no live timer.</summary>
|
||||
[Fact]
|
||||
public void OnLiveUpdatesToggled_Off_ThenDispose_LeavesNoLiveTimer()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user