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:
@@ -3,7 +3,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.InboundApi;
|
||||
namespace ZB.MOM.WW.ScadaBridge.InboundAPI.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// InboundAPI-014 / InboundAPI-M2.6: tests for return-value validation against a
|
||||
/// Tests for return-value validation against a
|
||||
/// method's <c>ReturnDefinition</c>. Mirrors <see cref="ParameterValidatorTests"/>
|
||||
/// (shared recursive engine) — RECURSIVE nested Object / List-element type
|
||||
/// validation with path-qualified errors.
|
||||
@@ -17,6 +17,8 @@ public class ReturnValueValidatorTests
|
||||
{
|
||||
// ── No definition → no validation (backward compatible) ───────────────────
|
||||
|
||||
/// <summary>Verifies that any result is valid when no return definition is declared.</summary>
|
||||
/// <param name="returnDefinition">The return definition under test, which is null or blank.</param>
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
@@ -27,6 +29,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null result is valid when no return definition is declared.</summary>
|
||||
[Fact]
|
||||
public void NoReturnDefinition_NullResult_IsValid()
|
||||
{
|
||||
@@ -36,6 +39,7 @@ public class ReturnValueValidatorTests
|
||||
|
||||
// ── Happy path: result matches the declared object shape ──────────────────
|
||||
|
||||
/// <summary>Verifies that a result matching the declared definition is valid.</summary>
|
||||
[Fact]
|
||||
public void ResultMatchingDefinition_IsValid()
|
||||
{
|
||||
@@ -52,6 +56,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a list of scalars whose elements have the declared type is valid.</summary>
|
||||
[Fact]
|
||||
public void ResultWithListOfScalars_TypeChecked_IsValid()
|
||||
{
|
||||
@@ -69,6 +74,7 @@ public class ReturnValueValidatorTests
|
||||
|
||||
// ── Scalar / shape mismatches must be reported ────────────────────────────
|
||||
|
||||
/// <summary>Verifies that a result missing a declared field is invalid.</summary>
|
||||
[Fact]
|
||||
public void ResultMissingDeclaredField_IsInvalid()
|
||||
{
|
||||
@@ -86,6 +92,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("totalUnits", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a result field of the wrong type is invalid.</summary>
|
||||
[Fact]
|
||||
public void ResultFieldWrongType_IsInvalid()
|
||||
{
|
||||
@@ -98,6 +105,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("totalUnits", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null result is invalid when a structure is required.</summary>
|
||||
[Fact]
|
||||
public void NullResultWhenStructureRequired_IsInvalid()
|
||||
{
|
||||
@@ -108,6 +116,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.False(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a non-object result is invalid when a structure is required.</summary>
|
||||
[Fact]
|
||||
public void NonObjectResultWhenStructureRequired_IsInvalid()
|
||||
{
|
||||
@@ -118,6 +127,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.False(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a list field given a non-array value is invalid.</summary>
|
||||
[Fact]
|
||||
public void ListFieldGivenNonArray_IsInvalid()
|
||||
{
|
||||
@@ -130,6 +140,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("lines", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a malformed return definition is invalid.</summary>
|
||||
[Fact]
|
||||
public void MalformedReturnDefinition_IsInvalid()
|
||||
{
|
||||
@@ -138,7 +149,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.False(result.IsValid);
|
||||
}
|
||||
|
||||
// ── Nested validation: the M2.6 core (production-report shape) ─────────────
|
||||
// ── Nested validation: the core (production-report shape) ─────────────
|
||||
|
||||
private const string ReportDef = """
|
||||
{
|
||||
@@ -163,6 +174,7 @@ public class ReturnValueValidatorTests
|
||||
}
|
||||
""";
|
||||
|
||||
/// <summary>Verifies that a valid nested return value passes validation.</summary>
|
||||
[Fact]
|
||||
public void ValidNestedReturn_Passes()
|
||||
{
|
||||
@@ -181,6 +193,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a wrong scalar inside a list element is invalid and the error path includes the element index.</summary>
|
||||
[Fact]
|
||||
public void WrongScalarInsideListElement_IsInvalid_WithElementIndexInPath()
|
||||
{
|
||||
@@ -202,6 +215,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("Integer", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a wrong list element type is invalid and the error path includes the element index.</summary>
|
||||
[Fact]
|
||||
public void WrongListElementType_IsInvalid_WithElementIndexInPath()
|
||||
{
|
||||
@@ -220,6 +234,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("Object", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a missing required nested field is invalid and the error path is qualified.</summary>
|
||||
[Fact]
|
||||
public void MissingRequiredNestedField_IsInvalid_PathQualified()
|
||||
{
|
||||
@@ -238,6 +253,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("'lines[0].units'", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an undeclared nested field is invalid and the error path is qualified.</summary>
|
||||
[Fact]
|
||||
public void UndeclaredNestedField_IsInvalid_PathQualified()
|
||||
{
|
||||
@@ -258,6 +274,7 @@ public class ReturnValueValidatorTests
|
||||
|
||||
// ── Empty / null edge cases ────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that an empty list against a typed element definition passes.</summary>
|
||||
[Fact]
|
||||
public void EmptyListAgainstTypedElement_Passes()
|
||||
{
|
||||
@@ -267,6 +284,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that any result is valid against an empty object schema.</summary>
|
||||
[Fact]
|
||||
public void EmptyObjectSchema_AnythingIsValid()
|
||||
{
|
||||
@@ -276,6 +294,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null optional nested scalar passes validation.</summary>
|
||||
[Fact]
|
||||
public void NullOptionalNestedScalar_Passes()
|
||||
{
|
||||
@@ -294,6 +313,7 @@ public class ReturnValueValidatorTests
|
||||
|
||||
// ── Legacy flat-array backward-compat ──────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that the legacy flat-array return definition is still accepted.</summary>
|
||||
[Fact]
|
||||
public void LegacyFlatArrayDefinition_StillAccepted()
|
||||
{
|
||||
@@ -311,6 +331,7 @@ public class ReturnValueValidatorTests
|
||||
// (Guards the intentional ParameterValidator/ReturnValueValidator asymmetry:
|
||||
// ReturnValueValidator must NOT short-circuit on non-object schema types.)
|
||||
|
||||
/// <summary>Verifies that a scalar string return schema validates a scalar string return.</summary>
|
||||
[Fact]
|
||||
public void ScalarStringReturnSchema_ValidatesScalarStringReturn()
|
||||
{
|
||||
@@ -319,6 +340,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a scalar integer return schema validates a scalar integer return.</summary>
|
||||
[Fact]
|
||||
public void ScalarIntegerReturnSchema_ValidatesScalarIntegerReturn()
|
||||
{
|
||||
@@ -326,6 +348,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.True(result.IsValid);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a scalar string return schema rejects an integer return.</summary>
|
||||
[Fact]
|
||||
public void ScalarStringReturnSchema_RejectsIntegerReturn()
|
||||
{
|
||||
@@ -334,6 +357,7 @@ public class ReturnValueValidatorTests
|
||||
Assert.Contains("String", result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a scalar boolean return schema validates a boolean return.</summary>
|
||||
[Fact]
|
||||
public void ScalarBooleanReturnSchema_ValidatesBooleanReturn()
|
||||
{
|
||||
@@ -343,6 +367,7 @@ public class ReturnValueValidatorTests
|
||||
|
||||
// FIX 2: recursion depth guard on Validate ─────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that validating a schema nested beyond the depth ceiling adds a depth error instead of throwing.</summary>
|
||||
[Fact]
|
||||
public void ValidateExceedingDepthCeiling_AddsDepthError_DoesNotThrow()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user