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:
@@ -8,7 +8,7 @@ using ZB.MOM.WW.ScadaBridge.CLI.Commands;
|
||||
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for the <c>scadabridge audit tree</c> subcommand (Audit Log #23 M5.1-T8):
|
||||
/// Tests for the <c>scadabridge audit tree</c> subcommand:
|
||||
/// tree rendering (table format), JSON output, error handling, and CLI parsing.
|
||||
/// </summary>
|
||||
[Collection("Console")]
|
||||
@@ -58,6 +58,7 @@ public class AuditTreeCommandTests
|
||||
// ParseNodes
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that parsing a valid JSON array returns the matching node DTOs.</summary>
|
||||
[Fact]
|
||||
public void ParseNodes_ValidArray_ReturnsDtos()
|
||||
{
|
||||
@@ -75,6 +76,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Equal(3, nodes[0].RowCount);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing an empty JSON array returns an empty list.</summary>
|
||||
[Fact]
|
||||
public void ParseNodes_EmptyArray_ReturnsEmpty()
|
||||
{
|
||||
@@ -82,6 +84,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Empty(nodes);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing invalid JSON returns an empty list.</summary>
|
||||
[Fact]
|
||||
public void ParseNodes_InvalidJson_ReturnsEmpty()
|
||||
{
|
||||
@@ -93,6 +96,7 @@ public class AuditTreeCommandTests
|
||||
// WriteTable — ASCII tree rendering
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that writing a table for no nodes prints the fallback message.</summary>
|
||||
[Fact]
|
||||
public void WriteTable_EmptyNodes_PrintsFallbackMessage()
|
||||
{
|
||||
@@ -101,6 +105,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Contains("no execution tree found", output.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that writing a table for a single root node prints it with no indent.</summary>
|
||||
[Fact]
|
||||
public void WriteTable_SingleRootNode_PrintsWithNoIndent()
|
||||
{
|
||||
@@ -117,6 +122,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Contains("[*]", line); // queried node marked
|
||||
}
|
||||
|
||||
/// <summary>Verifies that writing a table for a multi-level tree indents each child level correctly.</summary>
|
||||
[Fact]
|
||||
public void WriteTable_MultiLevelTree_IndentsChildrenCorrectly()
|
||||
{
|
||||
@@ -144,6 +150,7 @@ public class AuditTreeCommandTests
|
||||
Assert.StartsWith(" ", grandLine);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that writing a table marks the queried node and leaves the others unmarked.</summary>
|
||||
[Fact]
|
||||
public void WriteTable_QueriedNodeIsMarked_OthersAreNot()
|
||||
{
|
||||
@@ -167,6 +174,7 @@ public class AuditTreeCommandTests
|
||||
// WriteJson
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that writing JSON for valid nodes emits a valid JSON array.</summary>
|
||||
[Fact]
|
||||
public void WriteJson_ValidNodes_EmitsValidJsonArray()
|
||||
{
|
||||
@@ -183,6 +191,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Equal(2, doc.RootElement.GetArrayLength());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that writing JSON for no nodes emits an empty array.</summary>
|
||||
[Fact]
|
||||
public void WriteJson_EmptyNodes_EmitsEmptyArray()
|
||||
{
|
||||
@@ -204,14 +213,19 @@ public class AuditTreeCommandTests
|
||||
private readonly HttpStatusCode _status;
|
||||
private readonly string _body;
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>FixedHandler</c> class.</summary>
|
||||
/// <param name="status">The status.</param>
|
||||
/// <param name="body">The body.</param>
|
||||
public FixedHandler(HttpStatusCode status, string body)
|
||||
{
|
||||
_status = status;
|
||||
_body = body;
|
||||
}
|
||||
|
||||
/// <summary>Gets the last request uri value.</summary>
|
||||
public string? LastRequestUri { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Task<HttpResponseMessage> SendAsync(
|
||||
HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -223,6 +237,8 @@ public class AuditTreeCommandTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a successful tree run returns exit code zero and writes the output.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_Success_ReturnsZeroAndWritesOutput()
|
||||
{
|
||||
@@ -239,6 +255,8 @@ public class AuditTreeCommandTests
|
||||
Assert.Contains(rootId, output.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a tree run with an empty response returns exit code zero and prints the fallback message.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_EmptyResponse_ReturnsZeroWithFallbackMessage()
|
||||
{
|
||||
@@ -253,6 +271,8 @@ public class AuditTreeCommandTests
|
||||
Assert.Contains("no execution tree found", output.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a tree run with the JSON format emits valid JSON.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_JsonFormat_EmitsValidJson()
|
||||
{
|
||||
@@ -269,6 +289,8 @@ public class AuditTreeCommandTests
|
||||
Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a tree run that receives HTTP 403 returns exit code 2.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_Http403_ReturnsExitCode2()
|
||||
{
|
||||
@@ -282,6 +304,8 @@ public class AuditTreeCommandTests
|
||||
Assert.Equal(2, exit);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a tree run that receives HTTP 500 returns exit code 1.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_Http500_ReturnsExitCode1()
|
||||
{
|
||||
@@ -295,6 +319,8 @@ public class AuditTreeCommandTests
|
||||
Assert.Equal(1, exit);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the tree request URL contains the execution id.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunTree_RequestUrlContainsExecutionId()
|
||||
{
|
||||
@@ -313,6 +339,7 @@ public class AuditTreeCommandTests
|
||||
// CLI parsing — audit tree subcommand
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that the tree subcommand exists in the audit command group.</summary>
|
||||
[Fact]
|
||||
public void Tree_Subcommand_ExistsInAuditCommandGroup()
|
||||
{
|
||||
@@ -322,6 +349,7 @@ public class AuditTreeCommandTests
|
||||
Assert.Empty(parse.Errors);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the tree execution id option is required.</summary>
|
||||
[Fact]
|
||||
public void Tree_ExecutionIdOption_IsRequired()
|
||||
{
|
||||
@@ -332,6 +360,7 @@ public class AuditTreeCommandTests
|
||||
Assert.NotEqual(0, exit);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the tree help text describes the execution id.</summary>
|
||||
[Fact]
|
||||
public void Tree_HelpText_DescribesExecutionId()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user