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:
+31
@@ -20,6 +20,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
// Happy path
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that a 200 response returns the body.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_200_ReturnsBody()
|
||||
{
|
||||
@@ -32,6 +34,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
Assert.Equal(expectedBody, result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the request URL is built correctly.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_200_RequestUrlIsCorrect()
|
||||
{
|
||||
@@ -46,6 +50,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
handler.LastRequest!.RequestUri!.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the deployment token header is set on the request.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_200_SetsDeploymentTokenHeader()
|
||||
{
|
||||
@@ -59,6 +65,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
Assert.Equal("my-secret-token", handler.LastRequest.Headers.GetValues("X-Deployment-Token").Single());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a base URL with a trailing slash does not produce a double slash.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_BaseUrlWithTrailingSlash_NoDoubleSlashInUrl()
|
||||
{
|
||||
@@ -73,6 +81,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
Assert.Equal("http://central/api/internal/deployments/dep-1/config", url);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a deployment id needing escaping is escaped exactly once in the URL.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_DeploymentIdNeedingEscaping_EscapesOnceInUrl()
|
||||
{
|
||||
@@ -94,6 +104,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
// 404 → IsSuperseded = true
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that a 404 response throws with the superseded flag set.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_404_ThrowsWithIsSupersededTrue()
|
||||
{
|
||||
@@ -111,6 +123,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
// Other HTTP errors → IsSuperseded = false
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that a 401 response throws with the superseded flag clear.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_401_ThrowsWithIsSupersededFalse()
|
||||
{
|
||||
@@ -124,6 +138,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
Assert.Contains("401", ex.Message);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a 500 response throws with the superseded flag clear.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_500_ThrowsWithIsSupersededFalse()
|
||||
{
|
||||
@@ -141,6 +157,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
// Transport failure → DeploymentConfigFetchException (not raw HttpRequestException)
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that a transport exception is wrapped in a deployment config fetch exception.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_TransportException_WrapsAsDeploymentConfigFetchException()
|
||||
{
|
||||
@@ -155,6 +173,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
Assert.Contains("Connection refused", ex.Message);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an HTTP client timeout is wrapped as a transport error rather than a cancellation.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_HttpClientTimeout_WrapsAsTransportError_NotCancellation()
|
||||
{
|
||||
@@ -173,6 +193,8 @@ public class HttpDeploymentConfigFetcherTests
|
||||
// Cancellation propagates as-is
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// <summary>Verifies that a cancelled token propagates an operation-canceled exception.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task FetchAsync_CancelledToken_PropagatesOperationCanceledException()
|
||||
{
|
||||
@@ -194,14 +216,19 @@ public class HttpDeploymentConfigFetcherTests
|
||||
{
|
||||
private readonly HttpStatusCode _status;
|
||||
private readonly string _body;
|
||||
/// <summary>The last request the handler received.</summary>
|
||||
public HttpRequestMessage? LastRequest { get; private set; }
|
||||
|
||||
/// <summary>Creates a handler that always replies with the given status and body.</summary>
|
||||
/// <param name="status">The HTTP status code to return.</param>
|
||||
/// <param name="body">The response body to return.</param>
|
||||
public StubHandler(HttpStatusCode status, string body)
|
||||
{
|
||||
_status = status;
|
||||
_body = body;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken ct)
|
||||
{
|
||||
LastRequest = request;
|
||||
@@ -216,14 +243,18 @@ public class HttpDeploymentConfigFetcherTests
|
||||
private sealed class ThrowingHandler : HttpMessageHandler
|
||||
{
|
||||
private readonly Exception _ex;
|
||||
/// <summary>Creates a handler that throws the given exception.</summary>
|
||||
/// <param name="ex">The exception to throw.</param>
|
||||
public ThrowingHandler(Exception ex) => _ex = ex;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken ct)
|
||||
=> throw _ex;
|
||||
}
|
||||
|
||||
private sealed class DelayHandler : HttpMessageHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken ct)
|
||||
{
|
||||
await Task.Delay(Timeout.Infinite, ct);
|
||||
|
||||
Reference in New Issue
Block a user