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:
+24
-2
@@ -8,6 +8,7 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
{
|
||||
private readonly ILoggerFactory _loggerFactory = NullLoggerFactory.Instance;
|
||||
|
||||
/// <summary>Verifies that requesting the same site twice returns the same client.</summary>
|
||||
[Fact]
|
||||
public void GetOrCreate_ReturnsSameClientForSameSite()
|
||||
{
|
||||
@@ -19,6 +20,7 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.Same(client1, client2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that different sites get different clients.</summary>
|
||||
[Fact]
|
||||
public void GetOrCreate_ReturnsDifferentClientsForDifferentSites()
|
||||
{
|
||||
@@ -30,6 +32,8 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.NotSame(client1, client2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing a site disposes its client.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RemoveSite_DisposesClient()
|
||||
{
|
||||
@@ -43,6 +47,8 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.NotSame(client1, client2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing a site that does not exist does not throw.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RemoveSite_NonExistent_DoesNotThrow()
|
||||
{
|
||||
@@ -50,6 +56,8 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
await factory.RemoveSiteAsync("does-not-exist"); // Should not throw
|
||||
}
|
||||
|
||||
/// <summary>Verifies that disposing the factory disposes all clients.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DisposeAsync_DisposesAllClients()
|
||||
{
|
||||
@@ -64,10 +72,11 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
// This tests that Dispose doesn't throw
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a changed endpoint yields a client bound to the new endpoint.</summary>
|
||||
[Fact]
|
||||
public void GetOrCreate_EndpointChanged_ReturnsClientBoundToNewEndpoint()
|
||||
{
|
||||
// Communication-012 regression: when the same site is requested with a
|
||||
// Regression: when the same site is requested with a
|
||||
// *different* endpoint (the NodeA→NodeB failover flip), the factory must
|
||||
// hand back a client bound to the new endpoint, not the stale cached one.
|
||||
using var factory = new TrackingEndpointFactory();
|
||||
@@ -80,13 +89,14 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.Equal("http://localhost:5200", nodeB.Endpoint);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a different endpoint for the same site keeps both clients alive.</summary>
|
||||
[Fact]
|
||||
public void GetOrCreate_DifferentEndpointSameSite_KeepsBothClientsAlive()
|
||||
{
|
||||
// Arch review 02 (High): the cache is keyed by (site, endpoint). Both node
|
||||
// channels for a site coexist, so a per-session NodeA→NodeB failover flip
|
||||
// must NOT dispose the other endpoint's channel — another debug session may
|
||||
// be using it. (Supersedes Communication-013's dispose-on-endpoint-change.)
|
||||
// be using it. (This supersedes the earlier dispose-on-endpoint-change behaviour.)
|
||||
using var factory = new TrackingEndpointFactory();
|
||||
|
||||
var a = (TrackingEndpointClient)factory.GetOrCreate("site-a", "http://localhost:5100");
|
||||
@@ -97,6 +107,7 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.Same(a, factory.GetOrCreate("site-a", "http://localhost:5100")); // still cached
|
||||
}
|
||||
|
||||
/// <summary>Verifies that TryGet returns the cached client or null without creating one.</summary>
|
||||
[Fact]
|
||||
public void TryGet_ReturnsCachedClientOrNull_WithoutCreating()
|
||||
{
|
||||
@@ -109,6 +120,8 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.Equal(1, factory.CreatedCount); // TryGet never creates
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing a site disposes every endpoint client for that site and no other.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RemoveSiteAsync_DisposesAllEndpointsForTheSite_OnlyThatSite()
|
||||
{
|
||||
@@ -124,6 +137,7 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
Assert.False(other.Disposed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that requesting the same endpoint again neither disposes nor recreates the client.</summary>
|
||||
[Fact]
|
||||
public void GetOrCreate_SameEndpoint_DoesNotDisposeOrRecreate()
|
||||
{
|
||||
@@ -140,9 +154,14 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
/// <summary>Test client that records its endpoint and disposal (no real channel).</summary>
|
||||
private sealed class TrackingEndpointClient : SiteStreamGrpcClient
|
||||
{
|
||||
/// <summary>Initializes the client for the given endpoint without opening a real channel.</summary>
|
||||
/// <param name="endpoint">The gRPC endpoint the client is bound to.</param>
|
||||
public TrackingEndpointClient(string endpoint) : base(endpoint) { }
|
||||
/// <summary>Gets a value indicating whether the client has been disposed.</summary>
|
||||
public bool Disposed { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public override void Dispose() => Disposed = true;
|
||||
/// <inheritdoc />
|
||||
public override ValueTask DisposeAsync()
|
||||
{
|
||||
Disposed = true;
|
||||
@@ -153,8 +172,11 @@ public class SiteStreamGrpcClientFactoryTests
|
||||
/// <summary>Factory that hands out endpoint-tracking clients.</summary>
|
||||
private sealed class TrackingEndpointFactory : SiteStreamGrpcClientFactory
|
||||
{
|
||||
/// <summary>Initializes the factory with a null logger factory.</summary>
|
||||
public TrackingEndpointFactory() : base(NullLoggerFactory.Instance) { }
|
||||
/// <summary>Gets the number of clients this factory has created.</summary>
|
||||
public int CreatedCount { get; private set; }
|
||||
/// <inheritdoc />
|
||||
protected override SiteStreamGrpcClient CreateClient(string siteIdentifier, string grpcEndpoint)
|
||||
{
|
||||
CreatedCount++;
|
||||
|
||||
Reference in New Issue
Block a user