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:
@@ -5,10 +5,11 @@ namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for <see cref="ManagementEndpoints"/> request-body parsing
|
||||
/// (findings ManagementService-006 / -013).
|
||||
/// parsing and Ask-timeout resolution.
|
||||
/// </summary>
|
||||
public class ManagementEndpointsTests
|
||||
{
|
||||
/// <summary>Verifies that parsing a request with an explicit payload deserializes into the command type.</summary>
|
||||
[Fact]
|
||||
public void ParseCommand_WithExplicitPayload_DeserializesIntoCommandType()
|
||||
{
|
||||
@@ -24,13 +25,15 @@ public class ManagementEndpointsTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-6: <c>MgmtDeploySiteCommand.Force</c> is an ADDITIVE field, so a client
|
||||
/// <c>MgmtDeploySiteCommand.Force</c> is an ADDITIVE field, so a client
|
||||
/// that predates it — every CLI older than this change, and every scripted
|
||||
/// HTTP caller — must keep working and must land on the SAFE default. Absent
|
||||
/// means <c>false</c> means "skip instances whose config is unchanged", which
|
||||
/// is the non-destructive behaviour; only an explicit <c>true</c> restores the
|
||||
/// unconditional redeploy.
|
||||
/// </summary>
|
||||
/// <param name="json">The management request body to parse.</param>
|
||||
/// <param name="expectedForce">The expected value of the command's <c>Force</c> flag.</param>
|
||||
[Theory]
|
||||
[InlineData("""{ "command": "MgmtDeploySite", "payload": { "siteId": 7 } }""", false)]
|
||||
[InlineData("""{ "command": "MgmtDeploySite", "payload": { "siteId": 7, "force": false } }""", false)]
|
||||
@@ -45,6 +48,7 @@ public class ManagementEndpointsTests
|
||||
Assert.Equal(expectedForce, command.Force);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing a request with no payload deserializes a parameterless command.</summary>
|
||||
[Fact]
|
||||
public void ParseCommand_WithMissingPayload_DeserializesParameterlessCommand()
|
||||
{
|
||||
@@ -58,6 +62,7 @@ public class ManagementEndpointsTests
|
||||
Assert.IsType<ListTemplatesCommand>(result.Command);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing invalid JSON returns a failure.</summary>
|
||||
[Fact]
|
||||
public void ParseCommand_WithInvalidJson_ReturnsFailure()
|
||||
{
|
||||
@@ -67,6 +72,7 @@ public class ManagementEndpointsTests
|
||||
Assert.Equal("BAD_REQUEST", result.ErrorCode);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing a request without a command field returns a failure.</summary>
|
||||
[Fact]
|
||||
public void ParseCommand_WithMissingCommandField_ReturnsFailure()
|
||||
{
|
||||
@@ -76,6 +82,7 @@ public class ManagementEndpointsTests
|
||||
Assert.Equal("BAD_REQUEST", result.ErrorCode);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing an unknown command returns a failure.</summary>
|
||||
[Fact]
|
||||
public void ParseCommand_WithUnknownCommand_ReturnsFailure()
|
||||
{
|
||||
@@ -86,12 +93,13 @@ public class ManagementEndpointsTests
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Command-timeout configuration (finding ManagementService-010)
|
||||
// Command-timeout configuration
|
||||
//
|
||||
// ManagementServiceOptions.CommandTimeout must actually drive the Ask
|
||||
// timeout instead of a hard-coded 30s constant.
|
||||
// ========================================================================
|
||||
|
||||
/// <summary>Verifies that the Ask timeout uses the configured command timeout.</summary>
|
||||
[Fact]
|
||||
public void ResolveAskTimeout_UsesConfiguredCommandTimeout()
|
||||
{
|
||||
@@ -102,6 +110,7 @@ public class ManagementEndpointsTests
|
||||
Assert.Equal(TimeSpan.FromSeconds(75), timeout);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that null options fall back to the default Ask timeout.</summary>
|
||||
[Fact]
|
||||
public void ResolveAskTimeout_WithNullOptions_FallsBackToDefault()
|
||||
{
|
||||
@@ -110,6 +119,7 @@ public class ManagementEndpointsTests
|
||||
Assert.Equal(TimeSpan.FromSeconds(30), timeout);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a non-positive configured timeout falls back to the default Ask timeout.</summary>
|
||||
[Fact]
|
||||
public void ResolveAskTimeout_WithNonPositiveTimeout_FallsBackToDefault()
|
||||
{
|
||||
@@ -129,6 +139,8 @@ public class ManagementEndpointsTests
|
||||
// LongRunningCommandTimeout (default 5 min) instead of the 30 s default.
|
||||
// ========================================================================
|
||||
|
||||
/// <summary>Verifies that long-running commands use the long Ask timeout.</summary>
|
||||
/// <param name="cmd">The long-running command type under test.</param>
|
||||
[Theory]
|
||||
[InlineData(typeof(ImportBundleCommand))]
|
||||
[InlineData(typeof(ExportBundleCommand))]
|
||||
@@ -138,15 +150,18 @@ public class ManagementEndpointsTests
|
||||
public void ResolveAskTimeout_LongRunningCommand_UsesLongTimeout(Type cmd)
|
||||
=> Assert.Equal(TimeSpan.FromMinutes(5), ManagementEndpoints.ResolveAskTimeout(null, cmd));
|
||||
|
||||
/// <summary>Verifies that an ordinary command uses the default Ask timeout.</summary>
|
||||
[Fact]
|
||||
public void ResolveAskTimeout_OrdinaryCommand_UsesDefault()
|
||||
=> Assert.Equal(TimeSpan.FromSeconds(30), ManagementEndpoints.ResolveAskTimeout(null, typeof(ListTemplatesCommand)));
|
||||
|
||||
/// <summary>Verifies that a configured long-running timeout is honored.</summary>
|
||||
[Fact]
|
||||
public void ResolveAskTimeout_ConfiguredLongTimeout_Honored()
|
||||
=> Assert.Equal(TimeSpan.FromMinutes(10), ManagementEndpoints.ResolveAskTimeout(
|
||||
new ManagementServiceOptions { LongRunningCommandTimeout = TimeSpan.FromMinutes(10) },
|
||||
typeof(ImportBundleCommand)));
|
||||
/// <summary>Verifies that a bulk Ask timeout leaves a grace period beyond the overall scheduling deadline.</summary>
|
||||
[Fact]
|
||||
public void BulkAsk_LeavesGraceBeyondOverallSchedulingDeadline()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user