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,6 +8,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
{
|
||||
// ── Parse: ValueMatch ──────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that parsing a value-match configuration reads the canonical keys.</summary>
|
||||
[Fact]
|
||||
public void Parse_ValueMatch_ReadsCanonicalKeys()
|
||||
{
|
||||
@@ -20,6 +21,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(model.NotEquals);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing a value-match configuration accepts the legacy attribute and value keys.</summary>
|
||||
[Fact]
|
||||
public void Parse_ValueMatch_AcceptsLegacyAttributeAndValueKeys()
|
||||
{
|
||||
@@ -32,6 +34,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("Critical", model.MatchValue);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a not-equals prefix on the match value sets the not-equals flag and is stripped from the value.</summary>
|
||||
[Fact]
|
||||
public void Parse_ValueMatch_NotEqualsPrefix_SetsFlagAndStripsPrefix()
|
||||
{
|
||||
@@ -43,6 +46,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("Good", model.MatchValue);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a value-match configuration without a match value leaves it null.</summary>
|
||||
[Fact]
|
||||
public void Parse_ValueMatch_MissingMatchValue_LeavesNull()
|
||||
{
|
||||
@@ -57,6 +61,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Parse: RangeViolation ──────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that parsing a range-violation configuration reads the canonical keys.</summary>
|
||||
[Fact]
|
||||
public void Parse_RangeViolation_ReadsCanonicalKeys()
|
||||
{
|
||||
@@ -68,6 +73,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(100, model.Max);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing a range-violation configuration accepts the legacy low and high keys.</summary>
|
||||
[Fact]
|
||||
public void Parse_RangeViolation_AcceptsLegacyLowHighKeys()
|
||||
{
|
||||
@@ -79,6 +85,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(50, model.Max);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that canonical range-violation keys take precedence over legacy ones when both are present.</summary>
|
||||
[Fact]
|
||||
public void Parse_RangeViolation_CanonicalKeysWinOverLegacy()
|
||||
{
|
||||
@@ -91,6 +98,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(100, model.Max);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that numeric values stored as strings in a range-violation configuration are parsed.</summary>
|
||||
[Fact]
|
||||
public void Parse_RangeViolation_StringNumericValues_AreParsed()
|
||||
{
|
||||
@@ -105,6 +113,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Parse: RateOfChange ────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that parsing a rate-of-change configuration reads all of its fields.</summary>
|
||||
[Fact]
|
||||
public void Parse_RateOfChange_ReadsAllFields()
|
||||
{
|
||||
@@ -118,6 +127,9 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("rising", model.Direction);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that direction aliases in a rate-of-change configuration are normalized.</summary>
|
||||
/// <param name="input">The direction text as stored in the configuration.</param>
|
||||
/// <param name="expected">The expected normalized direction.</param>
|
||||
[Theory]
|
||||
[InlineData("rising", "rising")]
|
||||
[InlineData("Rising", "rising")]
|
||||
@@ -138,6 +150,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(expected, model.Direction);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a rate-of-change configuration without a direction defaults to either.</summary>
|
||||
[Fact]
|
||||
public void Parse_RateOfChange_MissingDirection_DefaultsToEither()
|
||||
{
|
||||
@@ -152,6 +165,8 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Parse: misc ────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that null, empty or whitespace input parses to the default model.</summary>
|
||||
/// <param name="input">The null, empty or whitespace configuration text.</param>
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
@@ -166,6 +181,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("either", model.Direction);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that malformed JSON parses to the default model without throwing.</summary>
|
||||
[Fact]
|
||||
public void Parse_MalformedJson_ReturnsDefaultModel_DoesNotThrow()
|
||||
{
|
||||
@@ -177,6 +193,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Serialize: ValueMatch ──────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that serializing a value-match model writes only the canonical keys.</summary>
|
||||
[Fact]
|
||||
public void Serialize_ValueMatch_WritesCanonicalKeysOnly()
|
||||
{
|
||||
@@ -201,6 +218,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(root.TryGetProperty("direction", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that serializing a not-equals value-match model prepends the not-equals marker to the match value.</summary>
|
||||
[Fact]
|
||||
public void Serialize_ValueMatch_NotEquals_PrependsBangEqualsToMatchValue()
|
||||
{
|
||||
@@ -217,6 +235,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("!=Good", doc.RootElement.GetProperty("matchValue").GetString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null attribute name is serialized as an empty string.</summary>
|
||||
[Fact]
|
||||
public void Serialize_ValueMatch_NullAttributeName_WritesEmptyString()
|
||||
{
|
||||
@@ -232,6 +251,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Serialize: RangeViolation ──────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that serializing a range-violation model writes the canonical numeric keys.</summary>
|
||||
[Fact]
|
||||
public void Serialize_RangeViolation_WritesCanonicalNumericKeys()
|
||||
{
|
||||
@@ -252,6 +272,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(root.TryGetProperty("matchValue", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null range bound is omitted from the serialized output.</summary>
|
||||
[Fact]
|
||||
public void Serialize_RangeViolation_NullBound_OmitsKey()
|
||||
{
|
||||
@@ -266,6 +287,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Serialize: RateOfChange ────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that serializing a rate-of-change model writes the threshold, window and direction.</summary>
|
||||
[Fact]
|
||||
public void Serialize_RateOfChange_WritesThresholdWindowAndDirection()
|
||||
{
|
||||
@@ -286,6 +308,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal("falling", root.GetProperty("direction").GetString());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that serializing a rate-of-change model always includes the direction.</summary>
|
||||
[Fact]
|
||||
public void Serialize_RateOfChange_AlwaysIncludesDirection()
|
||||
{
|
||||
@@ -301,6 +324,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Round-trip ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that a not-equals value-match model survives a serialize and parse round trip.</summary>
|
||||
[Fact]
|
||||
public void RoundTrip_ValueMatch_NotEquals_Preserved()
|
||||
{
|
||||
@@ -319,6 +343,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.True(round.NotEquals);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a range-violation model survives a serialize and parse round trip.</summary>
|
||||
[Fact]
|
||||
public void RoundTrip_RangeViolation_Preserved()
|
||||
{
|
||||
@@ -336,6 +361,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(original.Max, round.Max);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a rate-of-change model survives a serialize and parse round trip.</summary>
|
||||
[Fact]
|
||||
public void RoundTrip_RateOfChange_Preserved()
|
||||
{
|
||||
@@ -358,6 +384,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Parse: HiLo ────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that parsing a high-low configuration reads all setpoints and priorities.</summary>
|
||||
[Fact]
|
||||
public void Parse_HiLo_ReadsAllSetpointsAndPriorities()
|
||||
{
|
||||
@@ -376,6 +403,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Equal(900, model.HiHiPriority);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a high-low configuration with only some setpoints parses, leaving the missing ones null.</summary>
|
||||
[Fact]
|
||||
public void Parse_HiLo_AcceptsPartialSetpoints_MissingOnesAreNull()
|
||||
{
|
||||
@@ -393,6 +421,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── Serialize: HiLo ────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that serializing a high-low model omits null setpoints and priorities.</summary>
|
||||
[Fact]
|
||||
public void Serialize_HiLo_OmitsNullSetpointsAndPriorities()
|
||||
{
|
||||
@@ -418,6 +447,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(root.TryGetProperty("loPriority", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that serializing a high-low model does not leak fields that belong to other trigger types.</summary>
|
||||
[Fact]
|
||||
public void Serialize_HiLo_DoesNotLeakForeignTriggerTypeFields()
|
||||
{
|
||||
@@ -443,6 +473,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(root.TryGetProperty("direction", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parsing a high-low configuration reads the deadbands.</summary>
|
||||
[Fact]
|
||||
public void Parse_HiLo_ReadsDeadbands()
|
||||
{
|
||||
@@ -456,6 +487,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.Null(model.LoLoDeadband);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that serializing a high-low model omits null deadbands.</summary>
|
||||
[Fact]
|
||||
public void Serialize_HiLo_OmitsNullDeadbands()
|
||||
{
|
||||
@@ -475,6 +507,7 @@ public class AlarmTriggerConfigCodecTests
|
||||
Assert.False(doc.RootElement.TryGetProperty("loDeadband", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a high-low model preserves all of its fields through a serialize and parse round trip.</summary>
|
||||
[Fact]
|
||||
public void RoundTrip_HiLo_PreservesAllFields()
|
||||
{
|
||||
@@ -515,6 +548,9 @@ public class AlarmTriggerConfigCodecTests
|
||||
|
||||
// ── NormalizeDirection (direct) ────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that direction normalization handles every alias and falls back to either for unknown input.</summary>
|
||||
/// <param name="input">The direction text to normalize.</param>
|
||||
/// <param name="expected">The expected normalized direction.</param>
|
||||
[Theory]
|
||||
[InlineData("rising", "rising")]
|
||||
[InlineData("RISING", "rising")]
|
||||
|
||||
Reference in New Issue
Block a user