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:
+49
-1
@@ -20,11 +20,14 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
private readonly TestLocalDb _localDb;
|
||||
private SiteStorageService _storage = null!;
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>SiteStorageServiceTests</c> class.</summary>
|
||||
public SiteStorageServiceTests()
|
||||
{
|
||||
_localDb = TestLocalDb.CreateTemp("site-storage-test");
|
||||
}
|
||||
|
||||
/// <summary>Prepares the fixture before the tests run.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
_storage = new SiteStorageService(
|
||||
@@ -33,8 +36,11 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
await _storage.InitializeAsync();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources used by this instance asynchronously.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task DisposeAsync() => Task.CompletedTask;
|
||||
|
||||
/// <summary>Releases the resources used by this instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
// Dispose first — the master connection anchors the WAL, so the sidecars
|
||||
@@ -44,6 +50,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
TestLocalDb.DeleteFiles(path);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that initialization creates the tables without error.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task InitializeAsync_CreatesTablesWithoutError()
|
||||
{
|
||||
@@ -52,6 +60,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
await _storage.InitializeAsync();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that initialization enables the write-ahead-log journal mode.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Initialize_EnablesWalJournalMode()
|
||||
{
|
||||
@@ -72,6 +82,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal("wal", mode.ToLowerInvariant());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a stored deployed config can be retrieved unchanged.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreAndRetrieve_DeployedConfig_RoundTrips()
|
||||
{
|
||||
@@ -88,7 +100,7 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.True(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
// ── Register P1-4: projected single-row reads ──
|
||||
// ── Projected single-row reads ──
|
||||
//
|
||||
// GetAllDeployedConfigsAsync + FirstOrDefault materializes every deployed config —
|
||||
// including every ConfigJson blob — to find one row. These lock in that
|
||||
@@ -98,6 +110,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
// defect here is pure I/O cost, not an observable behavior difference, so these tests
|
||||
// pin the new projection's contract rather than reproduce a behavior bug.
|
||||
|
||||
/// <summary>Verifies that a single-config read returns the same row as reading all configs and picking the match.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedConfigAsync_ReturnsSameRowAs_GetAllThenFirstOrDefault()
|
||||
{
|
||||
@@ -120,6 +134,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(viaFullScan.DeployedAt, viaProjection.DeployedAt);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that reading the config of an unknown instance returns null.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedConfigAsync_UnknownInstance_ReturnsNull()
|
||||
{
|
||||
@@ -131,6 +147,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a metadata read returns the same identity as reading all configs and picking the match.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedConfigMetadataAsync_ReturnsSameIdentityAs_GetAllThenFirstOrDefault()
|
||||
{
|
||||
@@ -151,6 +169,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(viaFullScan.IsEnabled, metadata.IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that reading the metadata of an unknown instance returns null.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedConfigMetadataAsync_UnknownInstance_ReturnsNull()
|
||||
{
|
||||
@@ -162,6 +182,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that storing a deployed config for an existing instance replaces the previous row.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreDeployedConfig_Upserts_OnConflict()
|
||||
{
|
||||
@@ -178,6 +200,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.False(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing a deployed config also removes its static overrides.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RemoveDeployedConfig_RemovesConfigAndOverrides()
|
||||
{
|
||||
@@ -194,6 +218,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(overrides);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that setting the instance enabled state updates the stored flag.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetInstanceEnabled_UpdatesFlag()
|
||||
{
|
||||
@@ -211,6 +237,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.True(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that setting the enabled state of a nonexistent instance does not throw.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetInstanceEnabled_NonExistent_DoesNotThrow()
|
||||
{
|
||||
@@ -220,6 +248,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
|
||||
// ── Static Override Tests ──
|
||||
|
||||
/// <summary>Verifies that a static override can be stored and read back unchanged.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetAndGetStaticOverride_RoundTrips()
|
||||
{
|
||||
@@ -231,6 +261,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal("98.6", overrides["Temperature"]);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that setting a static override that already exists replaces its value.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetStaticOverride_Upserts_OnConflict()
|
||||
{
|
||||
@@ -243,6 +275,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal("100.0", overrides["Temperature"]);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clearing static overrides removes all of an instance's overrides.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ClearStaticOverrides_RemovesAll()
|
||||
{
|
||||
@@ -255,6 +289,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(overrides);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that static overrides are isolated per instance.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetStaticOverrides_IsolatedPerInstance()
|
||||
{
|
||||
@@ -270,6 +306,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.True(pump2.ContainsKey("Pressure"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that multiple instances have independent lifecycles.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MultipleInstances_IndependentLifecycle()
|
||||
{
|
||||
@@ -289,6 +327,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
|
||||
// ── Negative Tests ──
|
||||
|
||||
/// <summary>Verifies that the schema does not contain an alarm state table.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Schema_DoesNotContain_AlarmStateTable()
|
||||
{
|
||||
@@ -339,6 +379,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a conditional store inserts the config when no row exists.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreDeployedConfigIfNewer_NoExistingRow_Inserts()
|
||||
{
|
||||
@@ -356,6 +398,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.True(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a conditional store overwrites an existing older row.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreDeployedConfigIfNewer_ExistingOlderRow_Overwrites()
|
||||
{
|
||||
@@ -375,6 +419,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.False(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a conditional store does nothing when the existing row is newer.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreDeployedConfigIfNewer_ExistingNewerRow_IsNoop()
|
||||
{
|
||||
@@ -397,6 +443,8 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
|
||||
Assert.False(configs[0].IsEnabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a conditional store does nothing when the deployment times are equal.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StoreDeployedConfigIfNewer_EqualDeployedAt_IsNoop()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user