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:
@@ -18,7 +18,7 @@ using System.Security.Claims;
|
||||
namespace ZB.MOM.WW.ScadaBridge.InboundAPI.Tests.Middleware;
|
||||
|
||||
/// <summary>
|
||||
/// M4 Bundle D (D2) — verifies the production pipeline order from
|
||||
/// Verifies the production pipeline order from
|
||||
/// <c>ZB.MOM.WW.ScadaBridge.Host.Program.cs</c> for the inbound API:
|
||||
/// <c>UseAuthentication → UseAuthorization → UseAuditWriteMiddleware → endpoint</c>.
|
||||
///
|
||||
@@ -42,7 +42,10 @@ public class MiddlewareOrderTests
|
||||
/// </summary>
|
||||
private sealed class OrderingRecorder
|
||||
{
|
||||
/// <summary>Gets the stages recorded so far, in order.</summary>
|
||||
public List<string> Stages { get; } = new();
|
||||
/// <summary>Appends a stage name to the recorded list.</summary>
|
||||
/// <param name="stage">The name of the stage that ran.</param>
|
||||
public void Record(string stage)
|
||||
{
|
||||
lock (Stages) { Stages.Add(stage); }
|
||||
@@ -51,9 +54,11 @@ public class MiddlewareOrderTests
|
||||
|
||||
private sealed class RecordingAuditWriter : ICentralAuditWriter
|
||||
{
|
||||
// C3 (Task 2.5): store the decomposed row view so assertions keep
|
||||
// Store the decomposed row view so assertions keep
|
||||
// reading the ScadaBridge domain fields as typed properties.
|
||||
/// <summary>Gets the audit events written, as decomposed row views.</summary>
|
||||
public List<AuditRowProjection.AuditRowValues> Events { get; } = new();
|
||||
/// <inheritdoc />
|
||||
public Task WriteAsync(AuditEvent evt, CancellationToken ct = default)
|
||||
{
|
||||
lock (Events) { Events.Add(evt.AsRow()); }
|
||||
@@ -61,6 +66,8 @@ public class MiddlewareOrderTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the audit-write middleware runs after authentication and before script execution.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Middleware_Pipeline_PlacesAuditWriteAfterAuth_BeforeScriptExecution()
|
||||
{
|
||||
@@ -99,6 +106,8 @@ public class MiddlewareOrderTests
|
||||
Assert.Equal("test-actor", evt.Actor);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the pipeline records an authentication failure without reaching the endpoint.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Middleware_Pipeline_Records_AuthFailure_Beyond_Endpoint()
|
||||
{
|
||||
@@ -225,12 +234,17 @@ public class MiddlewareOrderTests
|
||||
/// </summary>
|
||||
private sealed class AlwaysAuthenticatedHandler : AuthenticationHandler<AuthenticationSchemeOptions>
|
||||
{
|
||||
/// <summary>Initializes the handler with the standard authentication-handler dependencies.</summary>
|
||||
/// <param name="options">The authentication scheme options monitor.</param>
|
||||
/// <param name="logger">The logger factory.</param>
|
||||
/// <param name="encoder">The URL encoder.</param>
|
||||
public AlwaysAuthenticatedHandler(
|
||||
Microsoft.Extensions.Options.IOptionsMonitor<AuthenticationSchemeOptions> options,
|
||||
Microsoft.Extensions.Logging.ILoggerFactory logger,
|
||||
System.Text.Encodings.Web.UrlEncoder encoder)
|
||||
: base(options, logger, encoder) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "framework-user") }, "TestScheme");
|
||||
@@ -249,12 +263,21 @@ public class MiddlewareOrderTests
|
||||
{
|
||||
private readonly AuditLogOptions _value;
|
||||
|
||||
/// <summary>Initializes the monitor with a fixed options value.</summary>
|
||||
/// <param name="value">The options value to return.</param>
|
||||
public StaticAuditLogOptionsMonitor(AuditLogOptions value) => _value = value;
|
||||
|
||||
/// <summary>Gets the fixed options value.</summary>
|
||||
public AuditLogOptions CurrentValue => _value;
|
||||
|
||||
/// <summary>Returns the fixed options value regardless of name.</summary>
|
||||
/// <param name="name">The named-options name, ignored.</param>
|
||||
/// <returns>The fixed options value.</returns>
|
||||
public AuditLogOptions Get(string? name) => _value;
|
||||
|
||||
/// <summary>Ignores the listener because the value never changes.</summary>
|
||||
/// <param name="listener">The change listener, ignored.</param>
|
||||
/// <returns>Always null.</returns>
|
||||
public IDisposable? OnChange(Action<AuditLogOptions, string?> listener) => null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user