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
@@ -5,7 +5,7 @@ using ZB.MOM.WW.ScadaBridge.TestSupport;
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Persistence;
/// <summary>
/// WP-33: Local Artifact Storage tests — shared scripts, external systems,
/// Local Artifact Storage tests — shared scripts, external systems,
/// database connections, notification lists.
/// </summary>
/// <remarks>
@@ -17,11 +17,14 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
private readonly TestLocalDb _localDb;
private SiteStorageService _storage = null!;
/// <summary>Creates a temporary LocalDb for the tests.</summary>
public ArtifactStorageTests()
{
_localDb = TestLocalDb.CreateTemp("artifact-test");
}
/// <summary>Creates and initializes the storage service under test.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public async Task InitializeAsync()
{
_storage = new SiteStorageService(
@@ -30,8 +33,11 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
await _storage.InitializeAsync();
}
/// <summary>Does nothing; there is no asynchronous cleanup.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public Task DisposeAsync() => Task.CompletedTask;
/// <summary>Disposes the test database and deletes its files.</summary>
public void Dispose()
{
// Dispose first — the master connection anchors the WAL, so the sidecars
@@ -43,6 +49,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
// ── Shared Script Storage ──
/// <summary>Verifies that a stored shared script round-trips.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreSharedScript_RoundTrips()
{
@@ -56,6 +64,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal("int", scripts[0].ReturnDefinition);
}
/// <summary>Verifies that storing a shared script with an existing name upserts it.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreSharedScript_Upserts_OnConflict()
{
@@ -68,6 +78,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal("{\"x\":\"int\"}", scripts[0].ParameterDefinitions);
}
/// <summary>Verifies that multiple shared scripts can be stored side by side.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreSharedScript_MultipleScripts()
{
@@ -79,6 +91,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(3, scripts.Count);
}
/// <summary>Verifies that a shared script with null optional fields can be stored.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreSharedScript_NullableFields()
{
@@ -92,6 +106,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
// ── External System Storage ──
/// <summary>Verifies that storing an external system does not throw.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreExternalSystem_DoesNotThrow()
{
@@ -102,6 +118,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
// No exception = success. Query verification would need a Get method.
}
/// <summary>Verifies that storing an external system with an existing name upserts it.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreExternalSystem_Upserts()
{
@@ -113,6 +131,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
// ── Database Connection Storage ──
/// <summary>Verifies that storing a database connection does not throw.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreDatabaseConnection_DoesNotThrow()
{
@@ -120,6 +140,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
"MainDB", "Server=localhost;Database=main", 3, TimeSpan.FromSeconds(1));
}
/// <summary>Verifies that storing a database connection with an existing name upserts it.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreDatabaseConnection_Upserts()
{
@@ -139,6 +161,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
// shared script / DB connection / data connection) stayed orphaned on the site
// forever and remained callable from site scripts.
/// <summary>Verifies that deleting shared scripts except a keep set removes orphans and keeps the present ones.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteSharedScriptsExcept_RemovesOrphans_KeepsPresent()
{
@@ -153,6 +177,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(["Keep1", "Keep2"], names);
}
/// <summary>Verifies that deleting external systems except a keep set removes orphans and keeps the present ones.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteExternalSystemsExcept_RemovesOrphans_KeepsPresent()
{
@@ -165,6 +191,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(["MES"], await TableNamesAsync("external_systems"));
}
/// <summary>Verifies that deleting database connections with an empty keep set deletes all of them.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteDatabaseConnectionsExcept_EmptyKeepSet_DeletesAll()
{
@@ -178,6 +206,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Empty(await TableNamesAsync("database_connections"));
}
/// <summary>Verifies that deleting data connection definitions except a keep set removes orphans and keeps the present ones.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteDataConnectionDefinitionsExcept_RemovesOrphans_KeepsPresent()
{
@@ -191,6 +221,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(["PlcA"], names);
}
/// <summary>Verifies that deleting with no orphans returns an empty result and is idempotent.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteRowsExcept_NoOrphans_ReturnsEmpty_AndIsIdempotent()
{
@@ -213,10 +245,10 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
return names;
}
// ── DeploymentManager-025 / SiteRuntime-031: central-only notif/SMTP purge ──
// ── Central-only notif/SMTP purge ──
//
// Notification config is central-only. The site-side write paths and
// SiteNotificationRepository were removed 2026-07-10 (arch-review 08 §1.3/#23);
// SiteNotificationRepository were removed 2026-07-10 (arch-review 08 §1.3);
// PurgeCentralOnlyNotificationConfigAsync is retained as the security cleanup for
// DBs written by older builds. These tests seed the (still-present) tables via raw
// SQL — the only way rows can now exist — and assert the purge empties them.
@@ -257,6 +289,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
return (long)(await command.ExecuteScalarAsync())!;
}
/// <summary>Verifies that the central-only purge removes persisted notification list and SMTP rows.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task PurgeCentralOnlyNotificationConfig_RemovesPersistedNotificationListsAndSmtpRows()
{
@@ -276,6 +310,8 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(0, await RowCountAsync("smtp_configurations"));
}
/// <summary>Verifies that the central-only purge is idempotent on empty tables.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task PurgeCentralOnlyNotificationConfig_IsIdempotent_OnEmptyTables()
{
@@ -287,8 +323,10 @@ public class ArtifactStorageTests : IAsyncLifetime, IDisposable
Assert.Equal(0, await RowCountAsync("smtp_configurations"));
}
// ── Schema includes all WP-33 tables ──
// ── Schema includes all artifact tables ──
/// <summary>Verifies that initialization creates all artifact tables.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Initialize_CreatesAllArtifactTables()
{