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:
+26
-2
@@ -16,7 +16,7 @@ using ZB.MOM.WW.ScadaBridge.Communication.Grpc;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Regression tests for arch-review 2026-08-19 P6-6 on the hub side. <c>SubscribeInstance</c>
|
||||
/// Regression tests for the hub-side subscribe race. <c>SubscribeInstance</c>
|
||||
/// awaits <c>StartStreamAsync</c> — up to 30s — and only then stores the session id on the
|
||||
/// connection. A client that disconnects inside that window ran <c>OnDisconnectedAsync</c>
|
||||
/// while there was still no session id to release, so the session stayed registered in the
|
||||
@@ -33,6 +33,7 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
private readonly TaskCompletionSource _entered = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
private readonly List<string> _stopped = new();
|
||||
|
||||
/// <summary>Creates the gated debug stream service with an unreleased start gate.</summary>
|
||||
public GatedDebugStreamService()
|
||||
: base(
|
||||
new CommunicationService(Options.Create(new CommunicationOptions()), NullLogger<CommunicationService>.Instance),
|
||||
@@ -42,6 +43,7 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>The fixed session id returned by every started stream.</summary>
|
||||
public string SessionId => "session-under-test";
|
||||
|
||||
/// <summary>Completes once <see cref="StartStreamAsync"/> has been entered.</summary>
|
||||
@@ -53,8 +55,10 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
get { lock (_stopped) { return _stopped.ToList(); } }
|
||||
}
|
||||
|
||||
/// <summary>Releases the start gate so a pending <c>StartStreamAsync</c> call completes.</summary>
|
||||
public void ReleaseStart() => _gate.TrySetResult();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task<DebugStreamSession> StartStreamAsync(
|
||||
int instanceId, Action<object> onEvent, Action onTerminated, CancellationToken ct = default)
|
||||
{
|
||||
@@ -69,6 +73,7 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
DateTimeOffset.UtcNow));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void StopStream(string sessionId)
|
||||
{
|
||||
lock (_stopped) { _stopped.Add(sessionId); }
|
||||
@@ -80,18 +85,31 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
private readonly FeatureCollection _features = new();
|
||||
private readonly CancellationTokenSource _aborted = new();
|
||||
|
||||
/// <summary>Creates a hub caller context over the supplied HTTP context.</summary>
|
||||
/// <param name="http">The HTTP context exposed through the hub context.</param>
|
||||
public TestHubCallerContext(HttpContext http) =>
|
||||
_features.Set<IHttpContextFeature>(new TestHttpContextFeature { HttpContext = http });
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ConnectionId => "test-conn";
|
||||
/// <inheritdoc />
|
||||
public override string? UserIdentifier => null;
|
||||
/// <inheritdoc />
|
||||
public override System.Security.Claims.ClaimsPrincipal? User => null;
|
||||
/// <inheritdoc />
|
||||
public override IDictionary<object, object?> Items { get; } = new Dictionary<object, object?>();
|
||||
/// <inheritdoc />
|
||||
public override IFeatureCollection Features => _features;
|
||||
/// <inheritdoc />
|
||||
public override CancellationToken ConnectionAborted => _aborted.Token;
|
||||
/// <inheritdoc />
|
||||
public override void Abort() => _aborted.Cancel();
|
||||
|
||||
private sealed class TestHttpContextFeature : IHttpContextFeature { public HttpContext? HttpContext { get; set; } }
|
||||
private sealed class TestHttpContextFeature : IHttpContextFeature
|
||||
{
|
||||
/// <summary>Gets or sets the HTTP context exposed by the feature.</summary>
|
||||
public HttpContext? HttpContext { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
private const string SessionIdKey = "DebugStreamSessionId";
|
||||
@@ -119,6 +137,8 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
return (hub, context, stream);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that subscribe instance, client disconnects mid start, stops the just created session.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SubscribeInstance_ClientDisconnectsMidStart_StopsTheJustCreatedSession()
|
||||
{
|
||||
@@ -139,6 +159,8 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
Assert.False(context.Items.ContainsKey(SessionIdKey));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that subscribe instance, connection aborted mid start, stops the just created session.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SubscribeInstance_ConnectionAbortedMidStart_StopsTheJustCreatedSession()
|
||||
{
|
||||
@@ -157,6 +179,8 @@ public class DebugStreamHubSubscribeRaceTests
|
||||
Assert.False(context.Items.ContainsKey(SessionIdKey));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that subscribe instance, then disconnect, stops the session exactly once.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SubscribeInstance_ThenDisconnect_StopsTheSessionExactlyOnce()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user