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:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -5,7 +5,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests;
/// <summary>
/// Regression tests for CLI-013 — the command-tree wiring was untested. These tests
/// Regression tests for the command-tree wiring, which was previously untested. These tests
/// build every command group and assert the tree is well-formed (every leaf has an
/// action, no group is empty), and that every management command record the CLI sends
/// resolves via <see cref="ManagementCommandRegistry"/> (so command-name derivation
@@ -21,6 +21,7 @@ public class CommandTreeTests
// Exercise the production root: a separately maintained group list can drift.
private static IEnumerable<Command> AllCommandGroups() => CliApplication.BuildRoot().Subcommands;
/// <summary>Verifies that the registered operational command groups include the secured-writes and connection tools.</summary>
[Fact]
public void RegisteredOperationalGroups_IncludeSecuredWritesAndConnectionTools()
{
@@ -47,6 +48,7 @@ public class CommandTreeTests
yield return leaf;
}
/// <summary>Verifies that every command group builds without throwing.</summary>
[Fact]
public void AllCommandGroups_Build_WithoutThrowing()
{
@@ -55,10 +57,11 @@ public class CommandTreeTests
Assert.All(groups, g => Assert.False(string.IsNullOrWhiteSpace(g.Name)));
}
/// <summary>Verifies that the set of command groups contains the audit and bundle groups.</summary>
[Fact]
public void AllCommandGroups_Contains_AuditAndBundle()
{
// CLI-022: explicit group-presence assertion so the harness does not
// Explicit group-presence assertion so the harness does not
// silently drift back to excluding new groups. Use names because that
// is what users actually type at the prompt.
var groupNames = AllCommandGroups().Select(g => g.Name).ToHashSet();
@@ -66,10 +69,11 @@ public class CommandTreeTests
Assert.Contains("bundle", groupNames);
}
/// <summary>Verifies that the audit command group exposes the query, export and verify-chain subcommands.</summary>
[Fact]
public void AuditCommandGroup_HasQueryExportAndVerifyChain()
{
// CLI-022: pin the audit sub-command surface so a rename / accidental
// Pin the audit sub-command surface so a rename / accidental
// removal of one of these is caught.
var audit = AuditCommands.Build(Url, Format, Username, Password);
var subNames = audit.Subcommands.Select(c => c.Name).ToHashSet();
@@ -78,10 +82,11 @@ public class CommandTreeTests
Assert.Contains("verify-chain", subNames);
}
/// <summary>Verifies that the bundle command group exposes the export, preview and import subcommands.</summary>
[Fact]
public void BundleCommandGroup_HasExportPreviewAndImport()
{
// CLI-022: pin the bundle sub-command surface.
// Pin the bundle sub-command surface.
var bundle = BundleCommands.Build(Url, Format, Username, Password);
var subNames = bundle.Subcommands.Select(c => c.Name).ToHashSet();
Assert.Contains("export", subNames);
@@ -89,6 +94,7 @@ public class CommandTreeTests
Assert.Contains("import", subNames);
}
/// <summary>Verifies that every leaf command in the tree has an action attached.</summary>
[Fact]
public void EveryLeafCommand_HasAnAction()
{
@@ -100,10 +106,11 @@ public class CommandTreeTests
Assert.True(leaf.Action != null, $"Leaf command '{leaf.Name}' has no action."));
}
/// <summary>Verifies that template composition delete is keyed by the composition id alone.</summary>
[Fact]
public void TemplateCompositionDelete_IsKeyedByIdOnly()
{
// CLI-015: the in-repo README documented `template composition delete` with
// The in-repo README documented `template composition delete` with
// --template-id / --instance-name, but the implementation keys deletion by the
// composition's own integer ID via a single --id option. Pin the real surface.
var template = TemplateCommands.Build(Url, Format, Username, Password);
@@ -116,6 +123,7 @@ public class CommandTreeTests
Assert.DoesNotContain("--instance-name", optionNames);
}
/// <summary>Verifies that the template native alarm source group has add, list and remove subcommands.</summary>
[Fact]
public void TemplateNativeAlarmSource_HasAddListRemove()
{
@@ -127,10 +135,11 @@ public class CommandTreeTests
Assert.Contains("remove", subNames);
}
/// <summary>Verifies that the deploy group has a site verb that requires a site id.</summary>
[Fact]
public void Deploy_HasSiteVerb_WithRequiredSiteId()
{
// WP2.5: bulk site deploy. Named `deploy site` to sit alongside
// Bulk site deploy. Named `deploy site` to sit alongside
// `deploy instance` / `deploy artifacts` — the group's convention is that
// the verb names the SCOPE of the deploy.
var deploy = DeployCommands.Build(Url, Format, Username, Password);
@@ -143,10 +152,11 @@ public class CommandTreeTests
Assert.Empty(site.Parse(["--site-id", "3"]).Errors);
}
/// <summary>Verifies that deploy site has a force flag that defaults to the non-destructive behaviour.</summary>
[Fact]
public void DeploySite_HasForceFlag_DefaultingToTheNonDestructiveBehaviour()
{
// P7-6: bulk deploy skips instances whose config is unchanged, because a
// Bulk deploy skips instances whose config is unchanged, because a
// redeploy resets their static overrides and native alarm state at the
// site. --force is the operator escape hatch (restored volume, rebuilt
// node) and must be a FLAG — absent means skip-unchanged, which is the
@@ -165,6 +175,7 @@ public class CommandTreeTests
Assert.True(withForce.GetValue(forceOption));
}
/// <summary>Verifies that the instance native alarm source group has set and clear subcommands.</summary>
[Fact]
public void InstanceNativeAlarmSource_HasSetAndClear()
{
@@ -175,6 +186,7 @@ public class CommandTreeTests
Assert.Contains("clear", subNames);
}
/// <summary>Verifies that the template folder group covers every folder management command.</summary>
[Fact]
public void TemplateFolder_HasFullManagementCommandParity()
{
@@ -192,6 +204,7 @@ public class CommandTreeTests
Assert.Contains("delete", subNames);
}
/// <summary>Verifies that the parent id is optional on template folder create so the root folder is reachable.</summary>
[Fact]
public void TemplateFolderCreate_ParentIdIsOptional_SoRootIsReachable()
{
@@ -211,6 +224,7 @@ public class CommandTreeTests
Assert.Equal(7, nestedParse.GetValue((Option<int?>)parentOption));
}
/// <summary>Verifies that the parent id is optional on template folder move so the root folder is reachable.</summary>
[Fact]
public void TemplateFolderMove_ParentIdIsOptional_SoRootIsReachable()
{
@@ -224,6 +238,8 @@ public class CommandTreeTests
Assert.Null(parse.GetValue((Option<int?>)parentOption));
}
/// <summary>Verifies that template folder reorder accepts the up and down directions.</summary>
/// <param name="direction">The reorder direction under test.</param>
[Theory]
[InlineData("up")]
[InlineData("down")]
@@ -237,6 +253,8 @@ public class CommandTreeTests
Assert.Empty(parse.Errors);
}
/// <summary>Verifies that the folder reorder command rejects any direction other than the accepted literals.</summary>
/// <param name="direction">The rejected direction value.</param>
[Theory]
[InlineData("sideways")]
// AcceptOnlyFromAmong is case-SENSITIVE, so the literals are lowercase only.
@@ -245,6 +263,8 @@ public class CommandTreeTests
// case-sensitivity rejected values the server accepts. --direction keeps it: it is
// a pure client-side literal that never reaches a server-side parse, so there is no
// authoritative check behind it to defer to.
/// <summary>Verifies that template folder reorder rejects any direction other than up or down.</summary>
/// <param name="direction">The invalid reorder direction under test.</param>
[InlineData("Up")]
public void TemplateFolderReorder_RejectsAnythingElse(string direction)
{
@@ -256,6 +276,7 @@ public class CommandTreeTests
Assert.NotEmpty(parse.Errors);
}
/// <summary>Verifies that template folder reorder requires a direction.</summary>
[Fact]
public void TemplateFolderReorder_RequiresDirection()
{
@@ -278,6 +299,8 @@ public class CommandTreeTests
// treatment row 88 gave `deploy status`). These tests fail before that change.
// ========================================================================
/// <summary>Provides the audit filter option names and sample values used by the theory data.</summary>
/// <returns>Theory data of subcommand, option and value triples.</returns>
public static TheoryData<string, string, string> AuditFilterValues() => new()
{
// subcommand, option, value — lowercase, uppercase and mixed case of a real member.
@@ -290,6 +313,10 @@ public class CommandTreeTests
{ "export", "--kind", "dbwrite" },
};
/// <summary>Verifies that audit filter options accept values in any letter case.</summary>
/// <param name="subcommand">The audit subcommand under test.</param>
/// <param name="option">The filter option name.</param>
/// <param name="value">The option value whose casing varies.</param>
[Theory]
[MemberData(nameof(AuditFilterValues))]
public void AuditFilterOptions_AcceptValuesInAnyCase(string subcommand, string option, string value)
@@ -308,6 +335,8 @@ public class CommandTreeTests
Assert.Empty(parse.Errors);
}
/// <summary>Verifies that the audit export format option accepts values in any letter case.</summary>
/// <param name="format">The export format value under test.</param>
[Theory]
[InlineData("csv")]
[InlineData("CSV")]
@@ -328,6 +357,7 @@ public class CommandTreeTests
Assert.Empty(parse.Errors);
}
/// <summary>Verifies that an unrecognised audit query filter value is not rejected on the client side.</summary>
[Fact]
public void AuditQuery_UnrecognisedFilterValue_IsNotRejectedClientSide()
{
@@ -342,6 +372,7 @@ public class CommandTreeTests
Assert.Empty(parse.Errors);
}
/// <summary>Verifies that the site area group has a move verb.</summary>
[Fact]
public void SiteArea_HasMoveVerb()
{
@@ -353,6 +384,7 @@ public class CommandTreeTests
Assert.Contains("move", subNames);
}
/// <summary>Verifies that the parent id is optional on site area move so the site root is reachable.</summary>
[Fact]
public void SiteAreaMove_ParentIdIsOptional_SoSiteRootIsReachable()
{
@@ -372,6 +404,7 @@ public class CommandTreeTests
Assert.Equal(2, reparentParse.GetValue((Option<int?>)parentOption));
}
/// <summary>Verifies that site area move requires an area id.</summary>
[Fact]
public void SiteAreaMove_RequiresId()
{
@@ -383,6 +416,7 @@ public class CommandTreeTests
Assert.NotEmpty(parse.Errors);
}
/// <summary>Verifies that template list has skip and take paging options.</summary>
[Fact]
public void TemplateList_HasSkipAndTakePagingOptions()
{
@@ -394,6 +428,7 @@ public class CommandTreeTests
Assert.Contains("--take", optionNames);
}
/// <summary>Verifies that instance list has skip and take paging options.</summary>
[Fact]
public void InstanceList_HasSkipAndTakePagingOptions()
{
@@ -405,6 +440,7 @@ public class CommandTreeTests
Assert.Contains("--take", optionNames);
}
/// <summary>Verifies that instance list parses the value of the take option.</summary>
[Fact]
public void InstanceList_ParsesTakeOptionValue()
{
@@ -418,6 +454,8 @@ public class CommandTreeTests
Assert.Equal(5, parse.GetValue((Option<int?>)takeOption));
}
/// <summary>Verifies that each command payload type resolves through the management command registry.</summary>
/// <param name="commandType">The command payload type under test.</param>
[Theory]
[InlineData(typeof(GetInstanceCommand))]
[InlineData(typeof(ListSitesCommand))]