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:
@@ -14,7 +14,7 @@ using ZB.MOM.WW.ScadaBridge.Host.Actors;
|
||||
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// LocalDb Phase 1 (Task 3) — locks the consolidated site database into the REAL site
|
||||
/// LocalDb Phase 1 — locks the consolidated site database into the REAL site
|
||||
/// composition root.
|
||||
/// <para>
|
||||
/// These tests build the actual container from
|
||||
@@ -34,6 +34,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
private readonly string _tempSiteDbPath;
|
||||
private readonly string _tempTrackingDbPath;
|
||||
|
||||
/// <summary>Builds the site host over a temporary LocalDb file.</summary>
|
||||
public SiteLocalDbWiringTests()
|
||||
{
|
||||
var stamp = Guid.NewGuid();
|
||||
@@ -78,6 +79,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
_host = builder.Build();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by this test class.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
(_host as IDisposable)?.Dispose();
|
||||
@@ -89,12 +91,14 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site composition root resolves the LocalDb service.</summary>
|
||||
[Fact]
|
||||
public void Site_Resolves_ILocalDb()
|
||||
{
|
||||
Assert.NotNull(_host.Services.GetService<ILocalDb>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site LocalDb registers both Phase 1 replicated tables.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_RegistersBothReplicatedTables()
|
||||
{
|
||||
@@ -108,6 +112,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Contains("site_events", db.ReplicatedTables.Keys);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the replicated tables declare explicit primary keys.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_ReplicatedTablesHaveExplicitPrimaryKeys()
|
||||
{
|
||||
@@ -121,6 +126,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Equal(["id"], db.ReplicatedTables["site_events"].PkColumns);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site LocalDb service is registered as a singleton.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_IsASingleton()
|
||||
{
|
||||
@@ -133,10 +139,11 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Same(first, second);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that replication is registered but inert when no peer is configured.</summary>
|
||||
[Fact]
|
||||
public void Site_Replication_IsRegistered_AndInertWithNoPeer()
|
||||
{
|
||||
// Task 7's default-OFF pin. This fixture configures NO
|
||||
// The default-OFF pin. This fixture configures NO
|
||||
// LocalDb:Replication:PeerAddress, which is the shipping default, so the
|
||||
// engine must resolve cleanly and sit idle rather than throw, retry, or
|
||||
// report a connection. "Default-off" here means inert, NOT unregistered —
|
||||
@@ -149,6 +156,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Null(status.LastSyncUtc);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a healthy idle node reports an oplog backlog of zero rather than null.</summary>
|
||||
[Fact]
|
||||
public void Site_Replication_OplogBacklog_IsZero_NotNull_OnAHealthyIdleNode()
|
||||
{
|
||||
@@ -156,22 +164,24 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
// wired, or the poll failed) and must never be reported as a healthy 0. On a
|
||||
// node whose local database is present and readable, a real 0 proves the
|
||||
// backlog provider is actually wired to the oplog — a null here would mean
|
||||
// Task 9's health signal is about to publish "unknown" forever.
|
||||
// The health signal is about to publish "unknown" forever.
|
||||
var status = _host.Services.GetRequiredService<ISyncStatus>();
|
||||
|
||||
Assert.Equal(0L, status.OplogBacklog);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the replication health bridge is registered as a hosted service.</summary>
|
||||
[Fact]
|
||||
public void Site_Replication_HealthBridge_IsRegisteredAsAHostedService()
|
||||
{
|
||||
// Task 9. Registered via a factory lambda, so ImplementationType is null and the
|
||||
// Registered via a factory lambda, so ImplementationType is null and the
|
||||
// only honest assertion is on the resolved instance.
|
||||
var hosted = _host.Services.GetServices<IHostedService>();
|
||||
|
||||
Assert.Contains(hosted, h => h is LocalDbReplicationStatusReporter);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the replication health bridge publishes its status onto the health report.</summary>
|
||||
[Fact]
|
||||
public void Site_Replication_HealthBridge_PublishesStatusOntoTheHealthReport()
|
||||
{
|
||||
@@ -202,6 +212,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Equal(0L, report.LocalDbOplogBacklog);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the LocalDb health report fields are null before the reporter has run.</summary>
|
||||
[Fact]
|
||||
public void Site_HealthReport_LocalDbFields_AreNull_BeforeTheReporterHasRun()
|
||||
{
|
||||
@@ -216,6 +227,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.Null(report.LocalDbOplogBacklog);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that site telemetry allowlists the LocalDb replication meter.</summary>
|
||||
[Fact]
|
||||
public void Site_Telemetry_Allowlists_TheLocalDbReplicationMeter()
|
||||
{
|
||||
@@ -228,15 +240,16 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
// This asserts on the allowlist constant, not on OTel's observed-meter set:
|
||||
// AddZbTelemetry applies its options to a local instance and never registers
|
||||
// IOptions, so there is nothing resolvable to interrogate. The end-to-end proof
|
||||
// that localdb_* actually reaches /metrics is the Task 12 live gate; this test
|
||||
// that localdb_* actually reaches /metrics is the live gate; this test
|
||||
// exists to stop the entry being dropped again.
|
||||
Assert.Contains(LocalDbMetrics.MeterName, SiteServiceRegistration.ObservedMeters);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the Phase 2 tables are created in the consolidated LocalDb file.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_CreatesThePhase2Tables_InTheConsolidatedFile()
|
||||
{
|
||||
// Phase 2 (Task 7). The nine configuration tables and the store-and-forward buffer
|
||||
// Phase 2. The nine configuration tables and the store-and-forward buffer
|
||||
// now live in the consolidated file rather than in scadabridge.db and
|
||||
// store-and-forward.db. Asserting through the REAL composition root is what proves
|
||||
// OnReady applies both schemas — the stores themselves also call Apply, so a test
|
||||
@@ -261,11 +274,12 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site LocalDb registers exactly the twelve expected replicated tables.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_RegistersExactlyTheTwelveReplicatedTables()
|
||||
{
|
||||
// The Phase 2 cutover, extended by site-secrets artifact deploy's deployed_secrets
|
||||
// and review finding M1's per-node secret_mirror_status.
|
||||
// and the per-node secret_mirror_status.
|
||||
// This is an EXACTLY check rather than a Contains in both directions, and both
|
||||
// directions are load-bearing.
|
||||
//
|
||||
@@ -292,6 +306,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
db.ReplicatedTables.Keys.OrderBy(k => k, StringComparer.Ordinal).ToArray());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the central-only notification tables are not replicated.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_DoesNotReplicateTheCentralOnlyNotificationTables()
|
||||
{
|
||||
@@ -305,6 +320,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.DoesNotContain("smtp_configurations", db.ReplicatedTables.Keys);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the node-local mirrored secrets ledger is not replicated.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_DoesNotReplicateTheNodeLocalMirroredSecretsLedger()
|
||||
{
|
||||
@@ -316,6 +332,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
Assert.DoesNotContain("mirrored_secrets", db.ReplicatedTables.Keys);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the replicated Phase 2 tables have their expected primary keys.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_ReplicatedPhase2TablesHaveTheirExpectedPrimaryKeys()
|
||||
{
|
||||
@@ -350,6 +367,7 @@ public class SiteLocalDbWiringTests : IDisposable
|
||||
return names;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site LocalDb creates the configured database file.</summary>
|
||||
[Fact]
|
||||
public void Site_LocalDb_CreatesTheConfiguredFile()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user