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:
@@ -7,7 +7,7 @@ using ZB.MOM.WW.ScadaBridge.Host;
|
||||
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// LocalDb Phase 1 (Task 6) — the one-time copy of the pre-Phase-1 site databases into
|
||||
/// LocalDb: the one-time copy of the pre-LocalDb site databases into
|
||||
/// the consolidated one.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -21,12 +21,14 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
private readonly string _root;
|
||||
private readonly List<ServiceProvider> _providers = [];
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>SiteLocalDbLegacyMigratorTests</c> class.</summary>
|
||||
public SiteLocalDbLegacyMigratorTests()
|
||||
{
|
||||
_root = Path.Combine(Path.GetTempPath(), $"localdb-migrator-{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(_root);
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by this test class.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var provider in _providers)
|
||||
@@ -43,9 +45,9 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
/// <summary>A consolidated database with the tables created and registered, as the host has it.</summary>
|
||||
/// <remarks>
|
||||
/// <c>sf_messages</c> is registered here even though production <c>OnReady</c> does not
|
||||
/// register it until the Task 14 cutover. The oplog assertion below needs live capture
|
||||
/// register it until the store-and-forward cutover. The oplog assertion below needs live capture
|
||||
/// triggers to mean anything, and the property under test — that the migrator runs after
|
||||
/// registration — is the same either way. The corollary is a real constraint on Task 14:
|
||||
/// registration — is the same either way. The corollary is a real constraint on that cutover:
|
||||
/// <c>Migrate</c> must stay the LAST call in <c>OnReady</c>, after every registration.
|
||||
/// </remarks>
|
||||
private ILocalDb CreateConsolidated(IConfiguration config)
|
||||
@@ -195,6 +197,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that missing legacy files are a no op.</summary>
|
||||
[Fact]
|
||||
public void MissingLegacyFiles_AreANoOp()
|
||||
{
|
||||
@@ -210,6 +213,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(0, CountRows(db, "site_events"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that legacy tracking rows are copied and the file is renamed.</summary>
|
||||
[Fact]
|
||||
public void LegacyTrackingRows_AreCopiedAndTheFileIsRenamed()
|
||||
{
|
||||
@@ -228,6 +232,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.True(File.Exists(trackingPath + ".migrated"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that legacy reads disable pooling or the rename fails on windows.</summary>
|
||||
[Fact]
|
||||
public void LegacyReadsDisablePooling_OrTheRenameFailsOnWindows()
|
||||
{
|
||||
@@ -251,6 +256,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Contains("Mode=ReadOnly", cs, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that legacy events get deterministic ids not fresh guids.</summary>
|
||||
[Fact]
|
||||
public void LegacyEvents_GetDeterministicIds_NotFreshGuids()
|
||||
{
|
||||
@@ -268,6 +274,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
SelectIds(db, "site_events", "id"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that second boot is a no op because the file is already marked migrated.</summary>
|
||||
[Fact]
|
||||
public void SecondBoot_IsANoOp_BecauseTheFileIsAlreadyMarkedMigrated()
|
||||
{
|
||||
@@ -285,6 +292,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(2, CountRows(db, "site_events"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that rerun against an unrenamed file does not duplicate.</summary>
|
||||
[Fact]
|
||||
public void RerunAgainstAnUnrenamedFile_DoesNotDuplicate()
|
||||
{
|
||||
@@ -311,6 +319,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(2, CountRows(db, "site_events"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that migrated rows enter the oplog so they actually replicate.</summary>
|
||||
[Fact]
|
||||
public void MigratedRows_EnterTheOplog_SoTheyActuallyReplicate()
|
||||
{
|
||||
@@ -332,10 +341,11 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(2L, (long)cmd.ExecuteScalar()!);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that sf messages are copied from the legacy file.</summary>
|
||||
[Fact]
|
||||
public void SfMessages_AreCopiedFromTheLegacyFile()
|
||||
{
|
||||
// Phase 2 (Task 8). Unlike the two Phase 1 files, the store-and-forward default path
|
||||
// Unlike the two earlier site database files, the store-and-forward default path
|
||||
// is inside the data volume, so on a real deployment this actually moves data:
|
||||
// undelivered messages that a lost migration would silently discard.
|
||||
var sfPath = Path_("store-and-forward.db");
|
||||
@@ -353,6 +363,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.True(File.Exists(sfPath + ".migrated"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that sf messages migration is idempotent when rerun after a crash before rename.</summary>
|
||||
[Fact]
|
||||
public void SfMessages_Migration_IsIdempotent_WhenRerunAfterACrashBeforeRename()
|
||||
{
|
||||
@@ -370,6 +381,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(2, CountRows(db, "sf_messages"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that migrated sf messages enter the oplog so they actually replicate.</summary>
|
||||
[Fact]
|
||||
public void MigratedSfMessages_EnterTheOplog_SoTheyActuallyReplicate()
|
||||
{
|
||||
@@ -389,6 +401,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(2L, (long)cmd.ExecuteScalar()!);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that sf messages from an older build migrate despite missing columns.</summary>
|
||||
[Fact]
|
||||
public void SfMessages_FromAnOlderBuild_MigrateDespiteMissingColumns()
|
||||
{
|
||||
@@ -463,10 +476,11 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that site config tables are copied from the legacy file.</summary>
|
||||
[Fact]
|
||||
public void SiteConfigTables_AreCopiedFromTheLegacyFile()
|
||||
{
|
||||
// Phase 2 (Task 9). All seven migrated tables live in one legacy file and are copied
|
||||
// All seven migrated tables live in one legacy file and are copied
|
||||
// in a single transaction: a partial config migration would leave a site node running
|
||||
// against half its old configuration, which is worse than failing startup.
|
||||
var sitePath = Path_("scadabridge.db");
|
||||
@@ -483,6 +497,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.True(File.Exists(sitePath + ".migrated"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that migration does not copy notification or smtp rows even when the legacy file has them.</summary>
|
||||
[Fact]
|
||||
public void Migration_DoesNotCopyNotificationOrSmtpRows_EvenWhenTheLegacyFileHasThem()
|
||||
{
|
||||
@@ -510,6 +525,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(0L, (long)cmd.ExecuteScalar()!);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that migrated config rows enter the oplog so they actually replicate.</summary>
|
||||
[Fact]
|
||||
public void MigratedConfigRows_EnterTheOplog_SoTheyActuallyReplicate()
|
||||
{
|
||||
@@ -527,6 +543,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(1L, (long)cmd.ExecuteScalar()!);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that site config migration is idempotent when rerun after a crash before rename.</summary>
|
||||
[Fact]
|
||||
public void SiteConfigMigration_IsIdempotent_WhenRerunAfterACrashBeforeRename()
|
||||
{
|
||||
@@ -543,6 +560,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(1, CountRows(db, table.Table));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that migrator column lists match the live schema.</summary>
|
||||
[Fact]
|
||||
public void MigratorColumnLists_MatchTheLiveSchema()
|
||||
{
|
||||
@@ -571,6 +589,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that legacy file without the expected table is treated as empty not a failure.</summary>
|
||||
[Fact]
|
||||
public void LegacyFileWithoutTheExpectedTable_IsTreatedAsEmpty_NotAFailure()
|
||||
{
|
||||
@@ -593,6 +612,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.True(File.Exists(trackingPath + ".migrated"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that in memory legacy connection strings are skipped.</summary>
|
||||
[Fact]
|
||||
public void InMemoryLegacyConnectionStrings_AreSkipped()
|
||||
{
|
||||
@@ -616,6 +636,7 @@ public class SiteLocalDbLegacyMigratorTests : IDisposable
|
||||
Assert.Equal(0, CountRows(db, "site_events"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that unset legacy keys fall back to the cwd relative code defaults.</summary>
|
||||
[Fact]
|
||||
public void UnsetLegacyKeys_FallBackToTheCwdRelativeCodeDefaults()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user