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
@@ -4,7 +4,7 @@ using ZB.MOM.WW.ScadaBridge.CLI.Commands;
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests.Commands;
/// <summary>
/// CLI-019 regression tests for <see cref="BundleCommands.StreamBase64ToFile"/>.
/// Regression tests for <see cref="BundleCommands.StreamBase64ToFile"/>.
/// The pre-fix code did <c>Convert.FromBase64String(...) → File.WriteAllBytes(...)</c>,
/// doubling the bundle's bytes onto the LOH and writing synchronously. The new
/// streaming helper decodes the base64 string in fixed-size chunks straight into
@@ -15,11 +15,13 @@ public class BundleCommandsStreamingTests : IDisposable
{
private readonly string _tempPath;
/// <summary>Creates a unique temporary output path for each test.</summary>
public BundleCommandsStreamingTests()
{
_tempPath = Path.Combine(Path.GetTempPath(), $"bundle-stream-test-{Guid.NewGuid():N}.bin");
}
/// <summary>Releases the resources used by this instance.</summary>
public void Dispose()
{
if (File.Exists(_tempPath))
@@ -28,6 +30,7 @@ public class BundleCommandsStreamingTests : IDisposable
}
}
/// <summary>Verifies that a small payload is written to the file and read back unchanged.</summary>
[Fact]
public void StreamBase64ToFile_SmallPayload_RoundTrips()
{
@@ -41,6 +44,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal(bytes, roundTripped);
}
/// <summary>Verifies that a payload spanning several chunks, with a short final chunk, round-trips unchanged.</summary>
[Fact]
public void StreamBase64ToFile_PayloadCrossesChunkBoundary_RoundTrips()
{
@@ -60,6 +64,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal(bytes, roundTripped);
}
/// <summary>Verifies that an empty base64 string produces an empty file.</summary>
[Fact]
public void StreamBase64ToFile_EmptyString_WritesEmptyFile()
{
@@ -70,6 +75,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Empty(File.ReadAllBytes(_tempPath));
}
/// <summary>Verifies that invalid base64 text throws a <see cref="FormatException"/>.</summary>
[Fact]
public void StreamBase64ToFile_InvalidBase64_ThrowsFormatException()
{
@@ -81,20 +87,23 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Throws<FormatException>(() => BundleCommands.StreamBase64ToFile(invalid, _tempPath));
}
/// <summary>Verifies that a null base64 string throws an <see cref="ArgumentNullException"/>.</summary>
[Fact]
public void StreamBase64ToFile_NullBase64_Throws()
{
Assert.Throws<ArgumentNullException>(() => BundleCommands.StreamBase64ToFile(null!, _tempPath));
}
/// <summary>Verifies that an empty output path throws an <see cref="ArgumentException"/>.</summary>
[Fact]
public void StreamBase64ToFile_EmptyOutputPath_Throws()
{
Assert.Throws<ArgumentException>(() => BundleCommands.StreamBase64ToFile("AAAA", string.Empty));
}
// ---- M8 (B4): --sites / --instances comma-split + flag parsing ----------
// ---- --sites / --instances comma-split + flag parsing ----------
/// <summary>Verifies that a comma-separated list is split and each name is trimmed.</summary>
[Fact]
public void ParseNameList_CommaSeparated_SplitsAndTrims()
{
@@ -103,6 +112,8 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal(new[] { "North-01", "East-02", "West-03" }, result);
}
/// <summary>Verifies that a null or blank token yields a null list.</summary>
/// <param name="token">The raw option value to parse.</param>
[Theory]
[InlineData(null)]
[InlineData("")]
@@ -112,6 +123,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Null(BundleCommands.ParseNameList(token));
}
/// <summary>Verifies that empty and whitespace-only entries are dropped from the list.</summary>
[Fact]
public void ParseNameList_EmptyEntries_AreDropped()
{
@@ -119,6 +131,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal(new[] { "a", "b", "c" }, result);
}
/// <summary>Verifies that the export command accepts the sites and instances flags without parse errors.</summary>
[Fact]
public void BundleExport_SitesAndInstancesFlags_ParseWithoutError()
{
@@ -138,14 +151,16 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Empty(parse.Errors);
}
// ---- M8 (D3): --map-site / --map-connection spec parsing ----------------
// ---- --map-site / --map-connection spec parsing ----------------
/// <summary>Verifies that a null mapping list yields no site mappings.</summary>
[Fact]
public void ParseSiteMappings_Null_ReturnsEmpty()
{
Assert.Empty(BundleCommands.ParseSiteMappings(null));
}
/// <summary>Verifies that a source=target spec maps the source site to an existing target site.</summary>
[Fact]
public void ParseSiteMappings_SrcEqualsDst_MapsToExisting()
{
@@ -155,6 +170,8 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal("PLANT-A", spec.TargetSiteIdentifier);
}
/// <summary>Verifies that a spec with no target means the site should be created new.</summary>
/// <param name="token">The raw site mapping spec.</param>
[Theory]
[InlineData("NORTH-01")] // no '=' part -> create-new
[InlineData("NORTH-01=")] // empty rhs -> create-new
@@ -167,6 +184,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Null(spec.TargetSiteIdentifier);
}
/// <summary>Verifies that repeated mapping specs accumulate into one list.</summary>
[Fact]
public void ParseSiteMappings_Repeated_AccumulatesAll()
{
@@ -176,12 +194,14 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Null(specs[1].TargetSiteIdentifier);
}
/// <summary>Verifies that a spec with an empty source throws a <see cref="FormatException"/>.</summary>
[Fact]
public void ParseSiteMappings_EmptySource_Throws()
{
Assert.Throws<FormatException>(() => BundleCommands.ParseSiteMappings(new[] { "=PLANT-A" }));
}
/// <summary>Verifies that a site/name=target spec maps the source connection to an existing target connection.</summary>
[Fact]
public void ParseConnectionMappings_SrcEqualsDst_MapsToExisting()
{
@@ -192,6 +212,8 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Equal("OpcLive", spec.TargetConnectionName);
}
/// <summary>Verifies that a connection spec with no target means the connection should be created new.</summary>
/// <param name="token">The raw connection mapping spec.</param>
[Theory]
[InlineData("NORTH-01/OpcA")] // no '=' part -> create-new
[InlineData("NORTH-01/OpcA=")] // empty rhs -> create-new
@@ -204,6 +226,8 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Null(spec.TargetConnectionName);
}
/// <summary>Verifies that a connection spec with a malformed source throws a <see cref="FormatException"/>.</summary>
/// <param name="token">The malformed connection mapping spec.</param>
[Theory]
[InlineData("OpcA")] // missing site/name shape
[InlineData("NORTH-01/")] // empty connection name
@@ -213,6 +237,7 @@ public class BundleCommandsStreamingTests : IDisposable
Assert.Throws<FormatException>(() => BundleCommands.ParseConnectionMappings(new[] { token }));
}
/// <summary>Verifies that the import command accepts the map and create-missing flags without parse errors.</summary>
[Fact]
public void BundleImport_MapAndCreateMissingFlags_ParseWithoutError()
{