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:
@@ -3,7 +3,7 @@ using ZB.MOM.WW.ScadaBridge.Transport.Import;
|
||||
namespace ZB.MOM.WW.ScadaBridge.Transport.Tests.Import;
|
||||
|
||||
/// <summary>
|
||||
/// Transport-004: <see cref="BundleUnlockRateLimiter"/> must enforce a per-key cap
|
||||
/// <see cref="BundleUnlockRateLimiter"/> must enforce a per-key cap
|
||||
/// over a trailing window — the design doc's "per-IP-per-hour" cap (§11). The
|
||||
/// limiter accepts any opaque caller key (typically a remote IP); these tests use
|
||||
/// IP-style strings to mirror the documented intent.
|
||||
@@ -13,11 +13,18 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
private sealed class TestClock : TimeProvider
|
||||
{
|
||||
private DateTimeOffset _now;
|
||||
/// <summary>Initializes a new instance of the <c>TestClock</c> class.</summary>
|
||||
/// <param name="start">The start.</param>
|
||||
public TestClock(DateTimeOffset start) { _now = start; }
|
||||
/// <inheritdoc />
|
||||
public override DateTimeOffset GetUtcNow() => _now;
|
||||
/// <summary>Advances the test clock by the given amount.</summary>
|
||||
/// <param name="delta">The delta.</param>
|
||||
public void Advance(TimeSpan delta) { _now += delta; }
|
||||
}
|
||||
|
||||
/// <summary>Verifies that registering an attempt under the limit returns true.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void TryRegisterAttempt_UnderLimit_ReturnsTrue()
|
||||
{
|
||||
@@ -36,6 +43,8 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
Assert.Equal(10, limiter.GetAttemptCount("10.0.0.1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that registering an attempt once the limit is reached is rejected.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void TryRegisterAttempt_AtLimit_RejectsNextAttempt()
|
||||
{
|
||||
@@ -60,6 +69,8 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
Assert.Equal(10, limiter.GetAttemptCount("10.0.0.1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that recorded attempts expire after the window elapses.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void TryRegisterAttempt_EntriesExpireAfterWindow()
|
||||
{
|
||||
@@ -83,6 +94,8 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
Assert.True(limiter.TryRegisterAttempt("10.0.0.1", maxAttemptsPerWindow: 10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a partial expiry releases only the oldest slot.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void TryRegisterAttempt_PartialExpiry_ReleasesOldestSlotOnly()
|
||||
{
|
||||
@@ -118,6 +131,8 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
Assert.False(limiter.TryRegisterAttempt("10.0.0.1", maxAttemptsPerWindow: 10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that attempts are counted independently per key.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void TryRegisterAttempt_PerKeyIsolation()
|
||||
{
|
||||
@@ -137,6 +152,9 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
Assert.Equal(10, limiter.GetAttemptCount("10.0.0.1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that registering an attempt with a blank key throws.</summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns>The result.</returns>
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
@@ -148,6 +166,9 @@ public sealed class BundleUnlockRateLimiterTests
|
||||
() => limiter.TryRegisterAttempt(key!, maxAttemptsPerWindow: 10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that registering an attempt with a non-positive limit throws.</summary>
|
||||
/// <param name="limit">The limit.</param>
|
||||
/// <returns>The result.</returns>
|
||||
[Theory]
|
||||
[InlineData(0)]
|
||||
[InlineData(-1)]
|
||||
|
||||
Reference in New Issue
Block a user