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:
@@ -6,8 +6,8 @@ using Microsoft.Extensions.Options;
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteEventLogging.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Regression tests for SiteEventLogging-005 (synchronous I/O on caller thread)
|
||||
/// and SiteEventLogging-008 (write failures silently swallowed).
|
||||
/// Regression tests for non-blocking logging (synchronous I/O on the caller thread)
|
||||
/// and surfaced write failures (failures silently swallowed).
|
||||
/// </summary>
|
||||
public class SiteEventLoggerAsyncTests : IDisposable
|
||||
{
|
||||
@@ -15,6 +15,7 @@ public class SiteEventLoggerAsyncTests : IDisposable
|
||||
private readonly string _dbPath;
|
||||
private readonly TestLocalDb _localDb;
|
||||
|
||||
/// <summary>Initializes the test class with a temporary LocalDb-backed event logger.</summary>
|
||||
public SiteEventLoggerAsyncTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"test_async_{Guid.NewGuid()}.db");
|
||||
@@ -23,6 +24,7 @@ public class SiteEventLoggerAsyncTests : IDisposable
|
||||
_logger = new SiteEventLogger(options, NullLogger<SiteEventLogger>.Instance, _localDb.Db);
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by this test class.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_logger.Dispose();
|
||||
@@ -30,10 +32,12 @@ public class SiteEventLoggerAsyncTests : IDisposable
|
||||
TestLocalDb.DeleteFiles(_dbPath);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that logging an event does not block the caller when the write is slow.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_DoesNotBlockCaller_WhenWriteIsSlow()
|
||||
{
|
||||
// SiteEventLogging-005: LogEventAsync must not perform the SQLite write
|
||||
// LogEventAsync must not perform the SQLite write
|
||||
// inline on the caller's thread. We hold the recorder busy on a long
|
||||
// database operation from one thread, then time how long it takes the
|
||||
// caller of LogEventAsync to get control back. If recording is offloaded
|
||||
@@ -71,6 +75,8 @@ public class SiteEventLoggerAsyncTests : IDisposable
|
||||
await recordTask.WaitAsync(TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the logging task completes only after the event is persisted.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_TaskCompletes_AfterEventIsPersisted()
|
||||
{
|
||||
@@ -86,10 +92,12 @@ public class SiteEventLoggerAsyncTests : IDisposable
|
||||
Assert.Equal(1, count);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a write error faults the logging task and increments the failure count.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_FaultsTask_AndCountsFailure_OnWriteError()
|
||||
{
|
||||
// SiteEventLogging-008: a write failure must not be silently swallowed.
|
||||
// A write failure must not be silently swallowed.
|
||||
// The returned Task must fault and the failure counter must increment so
|
||||
// Health Monitoring can surface a logging outage.
|
||||
using var failingConnection = new SqliteConnection("Data Source=:memory:");
|
||||
|
||||
Reference in New Issue
Block a user