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,11 +5,12 @@ using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests;
/// <summary>
/// Regression tests for CLI-005 — malformed <c>--bindings</c> / <c>--overrides</c> JSON
/// Regression tests: malformed <c>--bindings</c> / <c>--overrides</c> JSON
/// previously threw unhandled exceptions instead of producing a clean validation error.
/// </summary>
public class InstanceArgumentParsingTests
{
/// <summary>Verifies that valid bindings JSON is parsed into attribute and connection id pairs.</summary>
[Fact]
public void ParseBindings_ValidJson_ReturnsPairs()
{
@@ -23,6 +24,7 @@ public class InstanceArgumentParsingTests
Assert.Equal(new ConnectionBinding("Mode", 7), bindings[1]);
}
/// <summary>Verifies that malformed bindings JSON yields an error message instead of throwing an exception.</summary>
[Fact]
public void ParseBindings_MalformedJson_ReturnsErrorNotException()
{
@@ -33,6 +35,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that a binding pair with too few elements yields an error instead of throwing.</summary>
[Fact]
public void ParseBindings_ShortPair_ReturnsErrorNotException()
{
@@ -44,6 +47,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that binding elements of the wrong JSON types yield an error instead of throwing.</summary>
[Fact]
public void ParseBindings_WrongElementTypes_ReturnsErrorNotException()
{
@@ -55,6 +59,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that a bindings document of JSON null yields an error instead of throwing.</summary>
[Fact]
public void ParseBindings_JsonNull_ReturnsErrorNotException()
{
@@ -65,11 +70,12 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that the optional third binding element is captured as a data source reference override.</summary>
[Fact]
public void ParseBindings_ThreeElementForm_CapturesReferenceOverride()
{
// The optional 3rd element carries the per-instance data-source reference
// override (followup #4) so the CLI can SET it instead of always wiping it.
// override so the CLI can SET it instead of always wiping it.
var ok = InstanceCommands.TryParseBindings(
"[[\"Speed\", 5, \"ns=2;s=Spd\"], [\"Mode\", 7]]", out var bindings, out var error);
@@ -82,6 +88,7 @@ public class InstanceArgumentParsingTests
Assert.Null(bindings[1].DataSourceReferenceOverride);
}
/// <summary>Verifies that an explicit null third element leaves the reference override unset.</summary>
[Fact]
public void ParseBindings_ThirdElementExplicitNull_LeavesOverrideUnset()
{
@@ -94,6 +101,7 @@ public class InstanceArgumentParsingTests
Assert.Null(bindings![0].DataSourceReferenceOverride);
}
/// <summary>Verifies that a third binding element of the wrong type yields an error instead of throwing.</summary>
[Fact]
public void ParseBindings_ThirdElementWrongType_ReturnsErrorNotException()
{
@@ -106,6 +114,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that a binding with four elements yields an error instead of throwing.</summary>
[Fact]
public void ParseBindings_FourElements_ReturnsErrorNotException()
{
@@ -117,6 +126,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that valid overrides JSON is parsed into a dictionary.</summary>
[Fact]
public void ParseOverrides_ValidJson_ReturnsDictionary()
{
@@ -130,6 +140,7 @@ public class InstanceArgumentParsingTests
Assert.Null(overrides["Mode"]);
}
/// <summary>Verifies that malformed overrides JSON yields an error instead of throwing.</summary>
[Fact]
public void ParseOverrides_MalformedJson_ReturnsErrorNotException()
{
@@ -140,6 +151,7 @@ public class InstanceArgumentParsingTests
Assert.NotNull(error);
}
/// <summary>Verifies that an overrides document of JSON null yields an error instead of throwing.</summary>
[Fact]
public void ParseOverrides_JsonNull_ReturnsErrorNotException()
{
@@ -152,6 +164,7 @@ public class InstanceArgumentParsingTests
// --- instance bind-module (grouped connection bindings, 2026-08-20) ---
/// <summary>Verifies that a module rewrite changes only the named module's bindings and applies the requested connection.</summary>
[Fact]
public void BuildModuleRewrite_RewritesOnlyTheModule_AndKeepsConnection()
{
@@ -169,6 +182,7 @@ public class InstanceArgumentParsingTests
Assert.DoesNotContain(rewritten, b => b.AttributeName.StartsWith("Left"));
}
/// <summary>Verifies that the instance-level group matches attribute names that contain no dot.</summary>
[Fact]
public void BuildModuleRewrite_InstanceGroup_MatchesDotlessNames()
{
@@ -178,6 +192,7 @@ public class InstanceArgumentParsingTests
Assert.Equal("Z28063.ChlorineFlow", b.DataSourceReferenceOverride);
}
/// <summary>Verifies that an empty object path clears the data source reference override.</summary>
[Fact]
public void BuildModuleRewrite_EmptyObject_ClearsOverride()
{
@@ -188,6 +203,7 @@ public class InstanceArgumentParsingTests
Assert.Equal(2, b.DataConnectionId);
}
/// <summary>Verifies that surrounding whitespace and a trailing dot on the object path are trimmed.</summary>
[Fact]
public void BuildModuleRewrite_TrailingDotOnObject_IsTrimmed()
{
@@ -196,6 +212,7 @@ public class InstanceArgumentParsingTests
Assert.Equal("X.A", Assert.Single(r!).DataSourceReferenceOverride);
}
/// <summary>Verifies that an unknown module name produces an error listing the available modules.</summary>
[Fact]
public void BuildModuleRewrite_UnknownModule_ListsAvailable()
{
@@ -207,6 +224,7 @@ public class InstanceArgumentParsingTests
Assert.Contains("(instance)", error);
}
/// <summary>Verifies that existing bindings are read from camelCase instance JSON.</summary>
[Fact]
public void ParseExistingBindings_ReadsCamelCaseInstanceJson()
{
@@ -224,6 +242,7 @@ public class InstanceArgumentParsingTests
Assert.Equal(new ConnectionBinding("NoOverrideProp", 5), bindings[2]);
}
/// <summary>Verifies that instance JSON without a bindings array yields an empty list.</summary>
[Fact]
public void ParseExistingBindings_MissingArray_ReturnsEmpty()
{
@@ -231,6 +250,7 @@ public class InstanceArgumentParsingTests
Assert.Empty(InstanceCommands.ParseExistingBindings("""{"id":7,"connectionBindings":null}"""));
}
/// <summary>Verifies that the bind-module command parses its options and rejects a missing object path.</summary>
[Fact]
public void BindModule_ParsesOptions()
{