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:
@@ -12,7 +12,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Audit;
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteCallAudit.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Purge-scheduler tests for <see cref="SiteCallAuditActor"/> (#22, Piece B).
|
||||
/// Purge-scheduler tests for <see cref="SiteCallAuditActor"/>.
|
||||
/// Exercises the daily terminal-row purge tick in-memory — a recording
|
||||
/// <see cref="ISiteCallAuditRepository"/> captures the
|
||||
/// <see cref="ISiteCallAuditRepository.PurgeTerminalAsync"/> threshold the actor
|
||||
@@ -34,6 +34,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
/// <summary>Empty enumerator — the purge path never touches it, but it must be present to arm the scheduler.</summary>
|
||||
private sealed class EmptyEnumerator : ISiteEnumerator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteEntry>> EnumerateAsync(CancellationToken ct = default) =>
|
||||
Task.FromResult<IReadOnlyList<SiteEntry>>(Array.Empty<SiteEntry>());
|
||||
}
|
||||
@@ -41,6 +42,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
/// <summary>No-op pull client — present only to arm the scheduler.</summary>
|
||||
private sealed class NoOpPullClient : IPullSiteCallsClient
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Task<PullSiteCallsResponse> PullAsync(
|
||||
string siteId, DateTime sinceUtc, string? afterId, int batchSize, CancellationToken ct) =>
|
||||
Task.FromResult(new PullSiteCallsResponse(Array.Empty<SiteCall>(), MoreAvailable: false));
|
||||
@@ -52,32 +54,41 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
/// </summary>
|
||||
private sealed class RecordingRepo : ISiteCallAuditRepository
|
||||
{
|
||||
/// <summary>The cutoff thresholds passed to each purge call, in call order.</summary>
|
||||
public List<DateTime> PurgeThresholds { get; } = new();
|
||||
/// <summary>The row count each purge call reports as deleted.</summary>
|
||||
public int RowsDeletedPerCall { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<int> PurgeTerminalAsync(DateTime olderThanUtc, CancellationToken ct = default)
|
||||
{
|
||||
PurgeThresholds.Add(olderThanUtc);
|
||||
return Task.FromResult(RowsDeletedPerCall);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task UpsertAsync(SiteCall siteCall, CancellationToken ct = default) => Task.CompletedTask;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<SiteCall?> GetAsync(TrackedOperationId id, CancellationToken ct = default) =>
|
||||
Task.FromResult<SiteCall?>(null);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCall>> QueryAsync(
|
||||
SiteCallQueryFilter filter, SiteCallPaging paging, CancellationToken ct = default) =>
|
||||
Task.FromResult<IReadOnlyList<SiteCall>>(Array.Empty<SiteCall>());
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<SiteCallKpiSnapshot> ComputeKpisAsync(
|
||||
DateTime stuckCutoff, DateTime intervalSince, CancellationToken ct = default) =>
|
||||
Task.FromResult(new SiteCallKpiSnapshot(0, 0, 0, 0, null, 0));
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCallSiteKpiSnapshot>> ComputePerSiteKpisAsync(
|
||||
DateTime stuckCutoff, DateTime intervalSince, CancellationToken ct = default) =>
|
||||
Task.FromResult<IReadOnlyList<SiteCallSiteKpiSnapshot>>(Array.Empty<SiteCallSiteKpiSnapshot>());
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCallNodeKpiSnapshot>> ComputePerNodeKpisAsync(
|
||||
DateTime stuckCutoff, DateTime intervalSince, CancellationToken ct = default) =>
|
||||
Task.FromResult<IReadOnlyList<SiteCallNodeKpiSnapshot>>(Array.Empty<SiteCallNodeKpiSnapshot>());
|
||||
@@ -88,17 +99,24 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
{
|
||||
public int PurgeCallCount;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<int> PurgeTerminalAsync(DateTime olderThanUtc, CancellationToken ct = default)
|
||||
{
|
||||
Interlocked.Increment(ref PurgeCallCount);
|
||||
throw new InvalidOperationException("simulated purge failure");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task UpsertAsync(SiteCall siteCall, CancellationToken ct = default) => Task.CompletedTask;
|
||||
/// <inheritdoc />
|
||||
public Task<SiteCall?> GetAsync(TrackedOperationId id, CancellationToken ct = default) => Task.FromResult<SiteCall?>(null);
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCall>> QueryAsync(SiteCallQueryFilter f, SiteCallPaging p, CancellationToken ct = default) => Task.FromResult<IReadOnlyList<SiteCall>>(Array.Empty<SiteCall>());
|
||||
/// <inheritdoc />
|
||||
public Task<SiteCallKpiSnapshot> ComputeKpisAsync(DateTime a, DateTime b, CancellationToken ct = default) => Task.FromResult(new SiteCallKpiSnapshot(0, 0, 0, 0, null, 0));
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCallSiteKpiSnapshot>> ComputePerSiteKpisAsync(DateTime a, DateTime b, CancellationToken ct = default) => Task.FromResult<IReadOnlyList<SiteCallSiteKpiSnapshot>>(Array.Empty<SiteCallSiteKpiSnapshot>());
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteCallNodeKpiSnapshot>> ComputePerNodeKpisAsync(DateTime a, DateTime b, CancellationToken ct = default) => Task.FromResult<IReadOnlyList<SiteCallNodeKpiSnapshot>>(Array.Empty<SiteCallNodeKpiSnapshot>());
|
||||
}
|
||||
|
||||
@@ -115,7 +133,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Row-82/row-95 house pattern: every test in this file arms a
|
||||
/// House pattern: every test in this file arms a
|
||||
/// <c>PurgeIntervalOverride = 100ms</c> ticker. Left running past the test's own
|
||||
/// assertions it keeps firing against the recording repo — and, worse, against a
|
||||
/// scope-per-tick DI container whose lifetime the test no longer controls — for the
|
||||
@@ -132,6 +150,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
// 1. PurgeTick_CallsPurgeTerminal_WithRetentionThreshold
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that purge tick, calls purge terminal async, with retention threshold.</summary>
|
||||
[Fact]
|
||||
public void PurgeTick_CallsPurgeTerminalAsync_WithRetentionThreshold()
|
||||
{
|
||||
@@ -165,6 +184,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
// 2. PurgeTick_UsesDefaultRetention_365Days
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that purge tick, default retention, uses365 day threshold.</summary>
|
||||
[Fact]
|
||||
public void PurgeTick_DefaultRetention_Uses365DayThreshold()
|
||||
{
|
||||
@@ -193,6 +213,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
// 3. PurgeTick_RepoThrows_ActorStaysAlive_RetriesNextTick (continue-on-error)
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that purge tick, purge throws, actor stays alive, retries next tick.</summary>
|
||||
[Fact]
|
||||
public void PurgeTick_PurgeThrows_ActorStaysAlive_RetriesNextTick()
|
||||
{
|
||||
@@ -216,13 +237,14 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 4. SiteCallAudit-007: purge timer arms even when the reconciliation
|
||||
// 4. Purge timer arms even when the reconciliation
|
||||
// collaborators are ABSENT (production ctor, no IPullSiteCallsClient /
|
||||
// ISiteEnumerator registered). Proves the decoupling — a host that omits
|
||||
// the reconciliation client still purges, so the central SiteCalls table
|
||||
// cannot grow unbounded.
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that purge tick, production ctor, no reconciliation collaborators, still purges.</summary>
|
||||
[Fact]
|
||||
public void PurgeTick_ProductionCtor_NoReconciliationCollaborators_StillPurges()
|
||||
{
|
||||
@@ -232,7 +254,7 @@ public class SiteCallAuditPurgeTests : TestKit
|
||||
// ctor resolves per-tick, but deliberately registers NEITHER
|
||||
// IPullSiteCallsClient NOR ISiteEnumerator. GetService returns null for
|
||||
// both, so the actor's reconciliation tick is gated off — but the purge
|
||||
// tick must still arm (SiteCallAudit-007).
|
||||
// tick must still arm.
|
||||
var provider = new ServiceCollection()
|
||||
.AddScoped<ISiteCallAuditRepository>(_ => repo)
|
||||
.BuildServiceProvider();
|
||||
|
||||
Reference in New Issue
Block a user