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:
@@ -1,12 +1,14 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// WP-3: Tests for per-instance operation lock.
|
||||
/// Tests for per-instance operation lock.
|
||||
/// </summary>
|
||||
public class OperationLockManagerTests
|
||||
{
|
||||
private readonly OperationLockManager _lockManager = new();
|
||||
|
||||
/// <summary>Verifies that acquiring the lock returns a disposable handle.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_ReturnsDisposable()
|
||||
{
|
||||
@@ -14,6 +16,8 @@ public class OperationLockManagerTests
|
||||
Assert.NotNull(lockHandle);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a second caller for the same instance is blocked until the lock is released.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_SameInstance_BlocksSecondCaller()
|
||||
{
|
||||
@@ -24,6 +28,8 @@ public class OperationLockManagerTests
|
||||
_lockManager.AcquireAsync("inst1", TimeSpan.FromMilliseconds(50)));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that locks on different instances can both be acquired.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_DifferentInstances_BothSucceed()
|
||||
{
|
||||
@@ -34,6 +40,8 @@ public class OperationLockManagerTests
|
||||
Assert.NotNull(lock2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the lock can be re-acquired after it is released.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_AfterRelease_CanReacquire()
|
||||
{
|
||||
@@ -45,6 +53,8 @@ public class OperationLockManagerTests
|
||||
Assert.NotNull(secondLock);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance reports as locked while the lock is held.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task IsLocked_ReturnsTrueWhileLocked()
|
||||
{
|
||||
@@ -54,6 +64,8 @@ public class OperationLockManagerTests
|
||||
Assert.True(_lockManager.IsLocked("inst1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance reports as not locked after the lock is released.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task IsLocked_ReturnsFalseAfterRelease()
|
||||
{
|
||||
@@ -63,6 +75,8 @@ public class OperationLockManagerTests
|
||||
Assert.False(_lockManager.IsLocked("inst1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that disposing the lock handle twice does not throw.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_DoubleDispose_DoesNotThrow()
|
||||
{
|
||||
@@ -71,6 +85,8 @@ public class OperationLockManagerTests
|
||||
lockHandle.Dispose(); // Should not throw
|
||||
}
|
||||
|
||||
/// <summary>Verifies that acquiring the lock respects the cancellation token.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_CancellationToken_Respected()
|
||||
{
|
||||
@@ -81,6 +97,8 @@ public class OperationLockManagerTests
|
||||
_lockManager.AcquireAsync("inst1", TimeSpan.FromSeconds(30), cts.Token));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that concurrent acquisitions on different instances all succeed.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_ConcurrentDifferentInstances_AllSucceed()
|
||||
{
|
||||
@@ -93,8 +111,10 @@ public class OperationLockManagerTests
|
||||
await Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
// ── DeploymentManager-005: semaphore must not leak ──
|
||||
// ── Semaphore must not leak ──
|
||||
|
||||
/// <summary>Verifies that releasing a lock removes its semaphore entry.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_ReleasedLock_RemovesSemaphoreEntry()
|
||||
{
|
||||
@@ -110,6 +130,8 @@ public class OperationLockManagerTests
|
||||
Assert.Equal(0, _lockManager.TrackedLockCount);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that many distinct instances do not accumulate semaphores.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_ManyDistinctInstances_DoesNotAccumulateSemaphores()
|
||||
{
|
||||
@@ -123,6 +145,8 @@ public class OperationLockManagerTests
|
||||
Assert.Equal(0, _lockManager.TrackedLockCount);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a contended lock keeps its semaphore until the last release and then reclaims it.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AcquireAsync_ContendedLock_KeepsSemaphoreUntilLastReleaseThenReclaims()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user