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,7 +24,7 @@ using ZB.MOM.WW.ScadaBridge.Security;
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Audit;
|
||||
|
||||
/// <summary>
|
||||
/// Endpoint-level tests for the Audit Log CSV export (#23 M7-T14 / Bundle F).
|
||||
/// Endpoint-level tests for the Audit Log CSV export.
|
||||
///
|
||||
/// <para>
|
||||
/// CentralUI uses minimal-API endpoints (see <c>AuthEndpoints</c> /
|
||||
@@ -38,7 +38,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Audit;
|
||||
/// </summary>
|
||||
public class AuditExportEndpointsTests
|
||||
{
|
||||
// C3 (Task 2.5): the export endpoint reads canonical ZB.MOM.WW.Audit.AuditEvent
|
||||
// The export endpoint reads canonical ZB.MOM.WW.Audit.AuditEvent
|
||||
// rows straight off IAuditLogRepository.QueryAsync; build them via the factory.
|
||||
private static AuditEvent SampleEvent() =>
|
||||
ScadaBridgeAuditEventFactory.Create(
|
||||
@@ -71,7 +71,7 @@ public class AuditExportEndpointsTests
|
||||
web.ConfigureServices(services =>
|
||||
{
|
||||
services.AddRouting();
|
||||
// The endpoint is AuditExport-gated (#23 M7-T15 Bundle G);
|
||||
// The endpoint is AuditExport-gated;
|
||||
// the tests run as pre-authenticated principals built by
|
||||
// FakeAuthHandler (everyone has the Admin role), which is
|
||||
// one of AuditExportRoles, so the policy succeeds.
|
||||
@@ -79,7 +79,7 @@ public class AuditExportEndpointsTests
|
||||
.AddScheme<Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions, FakeAuthHandler>(
|
||||
FakeAuthHandler.SchemeName, _ => { });
|
||||
// Use the real production policy wiring so the endpoint's
|
||||
// updated AuditExport gate (#23 M7-T15 Bundle G) is what
|
||||
// updated AuditExport gate is what
|
||||
// the tests exercise. The fake principal carries the
|
||||
// "Administrator" role, which AuditExportRoles permits.
|
||||
services.AddScadaBridgeAuthorization();
|
||||
@@ -103,6 +103,8 @@ public class AuditExportEndpointsTests
|
||||
return (client, repo, host);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a GET to the export endpoint returns a CSV content type and an attachment content disposition.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_Get_ReturnsCsvContentType_AndAttachmentDisposition()
|
||||
{
|
||||
@@ -131,6 +133,8 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the export endpoint parses the query string into a filter and passes it to the export service.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_PassesFilterFromQueryString_ToService()
|
||||
{
|
||||
@@ -180,6 +184,8 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a request without a query string passes an empty filter to the export service.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_NoQueryString_PassesEmptyFilter()
|
||||
{
|
||||
@@ -210,11 +216,13 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unrecognized enum value in the query string is silently ignored instead of failing the export.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_UnknownEnumValue_SilentlyIgnored()
|
||||
{
|
||||
// Defensive parsing: a junk channel value MUST NOT 500 the export —
|
||||
// mirrors the page-level query-string parser (#23 M7 Bundle D) which
|
||||
// mirrors the page-level query-string parser, which
|
||||
// silently drops unrecognised values.
|
||||
var (client, repo, host) = await BuildHostAsync();
|
||||
using (host)
|
||||
@@ -230,6 +238,8 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unparseable execution id in the query string is silently dropped from the filter.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_UnparseableExecutionId_SilentlyDropped()
|
||||
{
|
||||
@@ -249,6 +259,8 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unparseable parent execution id in the query string is silently dropped from the filter.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ExportEndpoint_UnparseableParentExecutionId_SilentlyDropped()
|
||||
{
|
||||
@@ -277,12 +289,17 @@ public class AuditExportEndpointsTests
|
||||
{
|
||||
public const string SchemeName = "FakeAuth";
|
||||
|
||||
/// <summary>Initializes the fake authentication handler.</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 FakeAuthHandler(
|
||||
IOptionsMonitor<AuthenticationSchemeOptions> options,
|
||||
ILoggerFactory logger,
|
||||
UrlEncoder encoder)
|
||||
: base(options, logger, encoder) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var claims = new[]
|
||||
@@ -297,6 +314,7 @@ public class AuditExportEndpointsTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the audit export route is registered as a GET endpoint.</summary>
|
||||
[Fact]
|
||||
public void ExportEndpoint_RouteIsRegistered()
|
||||
{
|
||||
|
||||
@@ -9,13 +9,14 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Audit;
|
||||
|
||||
/// <summary>
|
||||
/// Flow Debugger drill-ins (design 2026-09-05 §4, plan Task 21): the audit drawer's
|
||||
/// Flow Debugger drill-ins (design 2026-09-05 §4): the audit drawer's
|
||||
/// detail body and the Execution Chain page both offer <em>Open in Flow Debugger</em>,
|
||||
/// and the inbound-method form carries the <c>TraceAllCalls</c> checkbox wired to both
|
||||
/// save paths.
|
||||
/// </summary>
|
||||
public class FlowDebuggerDrillinTests : BunitContext
|
||||
{
|
||||
/// <summary>Initializes the test context with the services the drill-in components need.</summary>
|
||||
public FlowDebuggerDrillinTests()
|
||||
{
|
||||
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||
@@ -49,6 +50,7 @@ public class FlowDebuggerDrillinTests : BunitContext
|
||||
private static string Read(params string[] relative)
|
||||
=> File.ReadAllText(Path.Combine([SrcRoot, .. relative]));
|
||||
|
||||
/// <summary>Verifies that an audit event with an execution id offers an Open in Flow Debugger button that navigates to the replay.</summary>
|
||||
[Fact]
|
||||
public void AuditEventDetail_WithExecutionId_OffersOpenInFlowDebugger_AndNavigatesToReplay()
|
||||
{
|
||||
@@ -61,6 +63,7 @@ public class FlowDebuggerDrillinTests : BunitContext
|
||||
Assert.Contains($"/deployment/flow-debugger?executionId={exec}", nav.Uri);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an audit event without an execution id hides the Open in Flow Debugger button.</summary>
|
||||
[Fact]
|
||||
public void AuditEventDetail_WithoutExecutionId_HidesTheButton()
|
||||
{
|
||||
@@ -69,6 +72,7 @@ public class FlowDebuggerDrillinTests : BunitContext
|
||||
Assert.DoesNotContain("data-test=\"open-flow-debugger\"", cut.Markup);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the execution tree page links to the Flow Debugger replay beside the audit log link.</summary>
|
||||
[Fact]
|
||||
public void ExecutionTreePage_LinksToTheFlowDebuggerReplay_BesideTheAuditLogLink()
|
||||
{
|
||||
@@ -81,6 +85,7 @@ public class FlowDebuggerDrillinTests : BunitContext
|
||||
< markup.IndexOf("open-flow-debugger", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the API method form has a trace-all-calls checkbox wired to both the create and update save paths.</summary>
|
||||
[Fact]
|
||||
public void ApiMethodForm_HasTraceAllCallsCheckbox_WiredToBothSavePaths()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user