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:
+27
-2
@@ -11,7 +11,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Site;
|
||||
|
||||
/// <summary>
|
||||
/// Deferred-work #21: the backlog reporter's poll cadence is configurable via
|
||||
/// The backlog reporter's poll cadence is configurable via
|
||||
/// <see cref="SqliteAuditWriterOptions.BacklogPollIntervalSeconds"/> instead of the
|
||||
/// old hard-coded 30 s constant.
|
||||
/// </summary>
|
||||
@@ -26,6 +26,8 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
explicitInterval,
|
||||
options);
|
||||
|
||||
/// <summary>Verifies that stopping the reporter while a probe is in flight lets the loop complete cleanly.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StopAsync_WhileProbeInFlight_LoopCompletesCleanly()
|
||||
{
|
||||
@@ -62,10 +64,12 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
throw new UnreachableException("the delay above always throws on cancellation");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that stopping the reporter after it has been disposed does not throw.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StopAsync_AfterDispose_DoesNotThrow()
|
||||
{
|
||||
// Regression (Gitea #15 follow-up): Dispose tears down the CTS StopAsync
|
||||
// Regression (follow-up): Dispose tears down the CTS StopAsync
|
||||
// cancels, and the host does not guarantee StopAsync is driven before the DI
|
||||
// container is disposed. Cancel() on a disposed CTS throws, and letting that
|
||||
// escape an IHostedService aborts the host's whole shutdown sequence.
|
||||
@@ -79,6 +83,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
reporter.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the poll cadence comes from the options when one is configured.</summary>
|
||||
[Fact]
|
||||
public void Cadence_ComesFromOptions_WhenConfigured()
|
||||
{
|
||||
@@ -89,6 +94,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
Assert.Equal(TimeSpan.FromSeconds(12), reporter.RefreshInterval);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a non-positive configured interval falls back to the default cadence.</summary>
|
||||
[Fact]
|
||||
public void Cadence_FallsBackToDefault_WhenOptionsNonPositive()
|
||||
{
|
||||
@@ -99,6 +105,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
Assert.Equal(SiteAuditBacklogReporter.DefaultRefreshInterval, reporter.RefreshInterval);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the default cadence is used when no options are supplied.</summary>
|
||||
[Fact]
|
||||
public void Cadence_FallsBackToDefault_WhenNoOptions()
|
||||
{
|
||||
@@ -107,6 +114,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
Assert.Equal(SiteAuditBacklogReporter.DefaultRefreshInterval, reporter.RefreshInterval);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an explicitly supplied interval takes precedence over the options value.</summary>
|
||||
[Fact]
|
||||
public void ExplicitInterval_WinsOverOptions()
|
||||
{
|
||||
@@ -119,6 +127,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
|
||||
// ----- Stale-Pending signal (review F5) ----- //
|
||||
|
||||
/// <summary>Verifies that a stale pending backlog is logged as a warning and that repeat warnings are then rate-limited.</summary>
|
||||
[Fact]
|
||||
public void StalePendingBacklog_IsWarned_ThenRateLimited()
|
||||
{
|
||||
@@ -143,6 +152,7 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
Assert.Contains("pending", warning.Message, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a fresh or empty pending backlog does not log a warning.</summary>
|
||||
[Fact]
|
||||
public void FreshOrEmptyPendingBacklog_IsNotWarned()
|
||||
{
|
||||
@@ -163,12 +173,27 @@ public class SiteAuditBacklogReporterCadenceTests
|
||||
/// <summary>Captures log entries so the stale-pending signal can be asserted.</summary>
|
||||
private sealed class CapturingLogger : ILogger<SiteAuditBacklogReporter>
|
||||
{
|
||||
/// <summary>Gets the log entries captured so far.</summary>
|
||||
public List<(LogLevel Level, Exception? Exception, string Message)> Entries { get; } = new();
|
||||
|
||||
/// <summary>Returns no scope; the fake logger does not track scopes.</summary>
|
||||
/// <typeparam name="TState">The type of the scope state.</typeparam>
|
||||
/// <param name="state">The scope state, ignored.</param>
|
||||
/// <returns>Always null or a no-op scope.</returns>
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
|
||||
|
||||
/// <summary>Reports every log level as enabled.</summary>
|
||||
/// <param name="logLevel">The log level being queried.</param>
|
||||
/// <returns>Always true.</returns>
|
||||
public bool IsEnabled(LogLevel logLevel) => true;
|
||||
|
||||
/// <summary>Records the log entry for later assertions.</summary>
|
||||
/// <typeparam name="TState">The type of the log state.</typeparam>
|
||||
/// <param name="logLevel">The severity of the entry.</param>
|
||||
/// <param name="eventId">The event identifier.</param>
|
||||
/// <param name="state">The log state.</param>
|
||||
/// <param name="exception">The associated exception, if any.</param>
|
||||
/// <param name="formatter">Formats the state and exception into the message.</param>
|
||||
public void Log<TState>(
|
||||
LogLevel logLevel,
|
||||
EventId eventId,
|
||||
|
||||
Reference in New Issue
Block a user