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:
@@ -15,6 +15,9 @@ namespace ZB.MOM.WW.ScadaBridge.InboundAPI.Tests;
|
||||
|
||||
public class RelayProvenanceTests
|
||||
{
|
||||
/// <summary>Verifies that a genuine relay preserves the caller IP only when the signed request is intact.</summary>
|
||||
/// <param name="tamper">The kind of tampering applied to the relayed request.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Theory]
|
||||
[InlineData("none")]
|
||||
[InlineData("body")]
|
||||
@@ -59,6 +62,8 @@ public class RelayProvenanceTests
|
||||
if (tamper == "none") Assert.Equal(original.Items[AuditWriteMiddleware.InboundExecutionIdItemKey], row.ExecutionId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that directly forged forwarding headers cannot change the audited caller.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task EI5_DirectForgedForwardingHeadersCannotChangeAuditedCaller()
|
||||
{
|
||||
@@ -72,6 +77,8 @@ public class RelayProvenanceTests
|
||||
Assert.Equal("10.4.5.6", extra.RootElement.GetProperty("remoteIp").GetString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that when every authenticated peer is standby, only the origin node emits the failure audit.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task EI1_AllAuthenticatedPeersStandby_OnlyOriginEmitsFailureAudit()
|
||||
{
|
||||
@@ -98,7 +105,11 @@ public class RelayProvenanceTests
|
||||
Assert.Equal(original.Items[AuditWriteMiddleware.InboundExecutionIdItemKey], row.ExecutionId);
|
||||
}
|
||||
|
||||
private sealed class Standby : IActiveNodeGate { public bool IsActiveNode => false; }
|
||||
private sealed class Standby : IActiveNodeGate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool IsActiveNode => false;
|
||||
}
|
||||
|
||||
private static async Task AuditAsync(HttpContext context, Writer writer, IOptionsMonitor<InboundApiOptions> options, IActiveNodeGate? gate = null, IStandbyRequestForwarder? forwarder = null)
|
||||
{
|
||||
@@ -132,21 +143,34 @@ public class RelayProvenanceTests
|
||||
}
|
||||
private sealed class Writer : ICentralAuditWriter
|
||||
{
|
||||
/// <summary>Gets the audit events captured by this writer.</summary>
|
||||
public List<AuditEvent> Events { get; } = [];
|
||||
/// <inheritdoc />
|
||||
public Task WriteAsync(AuditEvent evt, CancellationToken ct = default) { Events.Add(evt); return Task.CompletedTask; }
|
||||
}
|
||||
private sealed class Monitor<T>(T value) : IOptionsMonitor<T>
|
||||
{
|
||||
/// <summary>Gets the fixed options value.</summary>
|
||||
public T CurrentValue => value;
|
||||
/// <summary>Returns the fixed options value regardless of name.</summary>
|
||||
/// <param name="name">The options name, ignored.</param>
|
||||
/// <returns>The fixed options value.</returns>
|
||||
public T Get(string? name) => value;
|
||||
/// <summary>Ignores the change listener; the fake never raises change notifications.</summary>
|
||||
/// <param name="listener">The change listener, ignored.</param>
|
||||
/// <returns>Always <see langword="null"/>.</returns>
|
||||
public IDisposable? OnChange(Action<T, string?> listener) => null;
|
||||
}
|
||||
private sealed class Handler(Func<HttpRequestMessage, Task<HttpResponseMessage>> send) : HttpMessageHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) => send(request);
|
||||
}
|
||||
private sealed class Factory(HttpMessageHandler handler) : IHttpClientFactory
|
||||
{
|
||||
/// <summary>Creates an HTTP client over the fake message handler.</summary>
|
||||
/// <param name="name">The logical client name.</param>
|
||||
/// <returns>An HTTP client backed by the fake handler.</returns>
|
||||
public HttpClient CreateClient(string name) => new(handler, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user