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:
+46
-10
@@ -19,6 +19,7 @@ public class FlatteningServiceTests
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that flattening an empty template chain returns a failure.</summary>
|
||||
[Fact]
|
||||
public void Flatten_EmptyTemplateChain_ReturnsFailure()
|
||||
{
|
||||
@@ -34,6 +35,7 @@ public class FlatteningServiceTests
|
||||
Assert.Contains("empty", result.Error, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that flattening a single template resolves its attributes.</summary>
|
||||
[Fact]
|
||||
public void Flatten_SingleTemplate_ResolvesAttributes()
|
||||
{
|
||||
@@ -56,6 +58,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("Status", result.Value.Attributes[0].CanonicalName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that in an inheritance chain the derived template's value overrides the base.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InheritanceChain_DerivedOverridesBase()
|
||||
{
|
||||
@@ -83,6 +86,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("200.0", speed.Value); // Child's value wins
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a locked attribute is not overridden by a derived template.</summary>
|
||||
[Fact]
|
||||
public void Flatten_LockedAttribute_NotOverriddenByDerived()
|
||||
{
|
||||
@@ -105,6 +109,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("locked", locked.Value); // Base locked value preserved
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance override is applied to an unlocked attribute.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InstanceOverride_AppliedToUnlockedAttribute()
|
||||
{
|
||||
@@ -127,6 +132,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("Override", attr.Source);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance override is skipped for a locked attribute.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InstanceOverride_SkippedForLockedAttribute()
|
||||
{
|
||||
@@ -148,6 +154,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("original", attr.Value); // Lock honored
|
||||
}
|
||||
|
||||
/// <summary>Verifies that members of a composed module receive path-qualified names.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ComposedModule_PathQualifiedNames()
|
||||
{
|
||||
@@ -185,6 +192,7 @@ public class FlatteningServiceTests
|
||||
Assert.Contains(result.Value.Scripts, s => s.CanonicalName == "MainPump.Start");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that connection bindings are resolved correctly.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ConnectionBindings_ResolvedCorrectly()
|
||||
{
|
||||
@@ -217,6 +225,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("OpcUa", attr.BoundDataConnectionProtocol);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that alarms are resolved from the template chain.</summary>
|
||||
[Fact]
|
||||
public void Flatten_Alarms_ResolvedFromChain()
|
||||
{
|
||||
@@ -242,6 +251,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("RangeViolation", result.Value.Alarms[0].TriggerType);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that instance metadata is set correctly on the flattened configuration.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InstanceMetadata_SetCorrectly()
|
||||
{
|
||||
@@ -263,6 +273,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal(3, result.Value.AreaId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an inherited attribute on a derived template keeps the base value.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InheritedAttributeOnDerived_BaseValueWins()
|
||||
{
|
||||
@@ -290,6 +301,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("100.0", setPoint.Value);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an attribute overridden on a derived template takes the derived value.</summary>
|
||||
[Fact]
|
||||
public void Flatten_OverriddenAttributeOnDerived_DerivedValueWins()
|
||||
{
|
||||
@@ -317,6 +329,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("150.0", setPoint.Value);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that overriding an attribute locked in the derived template fails.</summary>
|
||||
[Fact]
|
||||
public void Flatten_LockedInDerivedOverride_Fails()
|
||||
{
|
||||
@@ -349,6 +362,7 @@ public class FlatteningServiceTests
|
||||
Assert.Contains("SetPoint", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an inherited script on a derived template keeps the base code.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InheritedScriptOnDerived_BaseCodeWins()
|
||||
{
|
||||
@@ -371,8 +385,9 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("return base;", script.Code);
|
||||
}
|
||||
|
||||
// ── M2.5 (#9): per-script execution timeout threads to ResolvedScript ───
|
||||
// ── Per-script execution timeout threads to ResolvedScript ───
|
||||
|
||||
/// <summary>Verifies that a script's execution timeout carries through to the resolved script.</summary>
|
||||
[Fact]
|
||||
public void Flatten_SingleTemplate_ScriptExecutionTimeoutSecondsThreadsThrough()
|
||||
{
|
||||
@@ -395,6 +410,7 @@ public class FlatteningServiceTests
|
||||
Assert.Null(dflt.ExecutionTimeoutSeconds);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a derived script override's execution timeout follows the winning row.</summary>
|
||||
[Fact]
|
||||
public void Flatten_DerivedScriptOverride_ExecutionTimeoutFollowsWinningRow()
|
||||
{
|
||||
@@ -427,6 +443,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal(3, script.ExecutionTimeoutSeconds);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an inherited script's execution timeout follows the base row.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InheritedScriptOnDerived_ExecutionTimeoutFollowsBaseRow()
|
||||
{
|
||||
@@ -459,8 +476,9 @@ public class FlatteningServiceTests
|
||||
Assert.Equal(10, script.ExecutionTimeoutSeconds);
|
||||
}
|
||||
|
||||
// ── TemplateEngine-002: per-slot alarm override ────────────────────────
|
||||
// ── Per-slot alarm override ────────────────────────
|
||||
|
||||
/// <summary>Verifies that an inherited alarm on a derived template keeps the base value.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InheritedAlarmOnDerived_BaseValueWins()
|
||||
{
|
||||
@@ -495,6 +513,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("{\"attributeName\":\"Temp\",\"high\":100}", alarm.TriggerConfiguration);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the MES-reportable flag keeps the base value through a derived chain.</summary>
|
||||
[Fact]
|
||||
public void Flatten_MesReportable_DerivedChain_BaseValueWins()
|
||||
{
|
||||
@@ -532,6 +551,7 @@ public class FlatteningServiceTests
|
||||
Assert.True(alarm.IsMesReportable);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an alarm overridden on a derived template takes the derived value.</summary>
|
||||
[Fact]
|
||||
public void Flatten_OverriddenAlarmOnDerived_DerivedValueWins()
|
||||
{
|
||||
@@ -566,6 +586,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("{\"attributeName\":\"Temp\",\"high\":120}", alarm.TriggerConfiguration);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that overriding an alarm locked in the derived template fails.</summary>
|
||||
[Fact]
|
||||
public void Flatten_LockedInDerivedAlarmOverride_Fails()
|
||||
{
|
||||
@@ -602,6 +623,7 @@ public class FlatteningServiceTests
|
||||
|
||||
// ── MES reportable flag: template value + instance override ────────────
|
||||
|
||||
/// <summary>Verifies that the template's MES-reportable value is carried to the resolved alarm.</summary>
|
||||
[Fact]
|
||||
public void Flatten_MesReportable_TemplateValueCarried()
|
||||
{
|
||||
@@ -633,6 +655,7 @@ public class FlatteningServiceTests
|
||||
Assert.False(result.Value.Alarms.First(a => a.CanonicalName == "LowTemp").IsMesReportable);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance override of false wins for the MES-reportable flag.</summary>
|
||||
[Fact]
|
||||
public void Flatten_MesReportable_OverrideFalseWins()
|
||||
{
|
||||
@@ -664,6 +687,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("Override", alarm.Source);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null instance override inherits the template's MES-reportable value.</summary>
|
||||
[Fact]
|
||||
public void Flatten_MesReportable_OverrideNullInherits()
|
||||
{
|
||||
@@ -695,8 +719,9 @@ public class FlatteningServiceTests
|
||||
Assert.True(alarm.IsMesReportable);
|
||||
}
|
||||
|
||||
// ── TemplateEngine-001: deep composition nesting ───────────────────────
|
||||
// ── Deep composition nesting ───────────────────────
|
||||
|
||||
/// <summary>Verifies that attributes, alarms and scripts all resolve through a three-level composition.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ThreeLevelComposition_AttributesAlarmsScriptsAllResolved()
|
||||
{
|
||||
@@ -749,6 +774,7 @@ public class FlatteningServiceTests
|
||||
s => s.CanonicalName == "MainPump.DriveMotor.FrontBearing.MonitorBearing");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a nested composed alarm's trigger attribute is prefixed with the module path.</summary>
|
||||
[Fact]
|
||||
public void Flatten_NestedComposedAlarm_TriggerAttributePrefixed()
|
||||
{
|
||||
@@ -786,8 +812,9 @@ public class FlatteningServiceTests
|
||||
Assert.Contains("MainPump.DriveMotor.FrontBearing.Vibration", alarm.TriggerConfiguration);
|
||||
}
|
||||
|
||||
// ── TemplateEngine-004: alarm on-trigger script resolution ─────────────
|
||||
// ── Alarm on-trigger script resolution ─────────────
|
||||
|
||||
/// <summary>Verifies that an alarm's on-trigger script resolves to its canonical name.</summary>
|
||||
[Fact]
|
||||
public void Flatten_AlarmOnTriggerScript_ResolvedToCanonicalName()
|
||||
{
|
||||
@@ -812,6 +839,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("HandleAlarm", alarm.OnTriggerScriptCanonicalName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a composed alarm's on-trigger script resolves with the module prefix.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ComposedAlarmOnTriggerScript_ResolvedWithPrefix()
|
||||
{
|
||||
@@ -845,14 +873,15 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("MainPump.PumpAlarmHandler", alarm.OnTriggerScriptCanonicalName);
|
||||
}
|
||||
|
||||
// ── TemplateEngine-016: composed-script ScriptScope.ParentPath ─────────
|
||||
// ── Composed-script ScriptScope.ParentPath ─────────
|
||||
|
||||
/// <summary>Verifies that a nested composed script's scope carries the correct parent path.</summary>
|
||||
[Fact]
|
||||
public void Flatten_NestedComposedScript_ScopeCarriesCorrectParentPath()
|
||||
{
|
||||
// Station composes Pump (level 1); Pump composes Motor (level 2).
|
||||
// The depth-1 script's parent is the root template (ParentPath "");
|
||||
// the depth-2 script's parent is the Pump module (ParentPath "MainPump").
|
||||
// The first-level script's parent is the root template (ParentPath "");
|
||||
// the second-level script's parent is the Pump module (ParentPath "MainPump").
|
||||
var motor = CreateTemplate(3, "Motor");
|
||||
motor.Scripts.Add(new TemplateScript("MonitorMotor", "// m") { Id = 70 });
|
||||
|
||||
@@ -883,10 +912,11 @@ public class FlatteningServiceTests
|
||||
|
||||
var depth2 = result.Value.Scripts.First(s => s.CanonicalName == "MainPump.DriveMotor.MonitorMotor");
|
||||
Assert.Equal("MainPump.DriveMotor", depth2.Scope.SelfPath);
|
||||
// Parent module of a depth-2 script is the enclosing Pump module.
|
||||
// Parent module of a second-level script is the enclosing Pump module.
|
||||
Assert.Equal("MainPump", depth2.Scope.ParentPath);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that native alarm sources are resolved from the template.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ResolvesNativeAlarmSources_FromTemplate()
|
||||
{
|
||||
@@ -903,6 +933,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("ns=2;s=P1", result.Value.NativeAlarmSources[0].SourceReference);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance override replaces a native alarm source reference.</summary>
|
||||
[Fact]
|
||||
public void Flatten_InstanceOverride_ReplacesNativeAlarmSourceReference()
|
||||
{
|
||||
@@ -921,10 +952,11 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("Override", result.Value.NativeAlarmSources[0].Source);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a locked native alarm source ignores an instance override.</summary>
|
||||
[Fact]
|
||||
public void Flatten_LockedNativeAlarmSource_IgnoresInstanceOverride()
|
||||
{
|
||||
// #05-T13: a native alarm source locked at the template level must not be
|
||||
// A native alarm source locked at the template level must not be
|
||||
// repointed by an instance override — the resolved source keeps the template
|
||||
// values and its Source stays "Template" (mirrors attribute/alarm lock rules).
|
||||
var template = CreateTemplate(1, "Base");
|
||||
@@ -947,8 +979,9 @@ public class FlatteningServiceTests
|
||||
Assert.True(src.IsLocked);
|
||||
}
|
||||
|
||||
// ── MV-4: ElementDataType carried through flatten/override ────────────
|
||||
// ── ElementDataType carried through flatten/override ────────────
|
||||
|
||||
/// <summary>Verifies that a list attribute's element data type is carried to the resolved attribute.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ListAttribute_ElementDataTypeCarriedToResolvedAttribute()
|
||||
{
|
||||
@@ -976,6 +1009,7 @@ public class FlatteningServiceTests
|
||||
Assert.Equal("String", attr.ElementDataType);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a list attribute's element data type is preserved through an instance override.</summary>
|
||||
[Fact]
|
||||
public void Flatten_ListAttributeWithInstanceOverride_ElementDataTypePreservedThroughOverride()
|
||||
{
|
||||
@@ -1012,6 +1046,7 @@ public class FlatteningServiceTests
|
||||
|
||||
// ── Repeated composition: same template under multiple slots ──────────
|
||||
|
||||
/// <summary>Verifies that a template composed twice resolves its nested members under both slots.</summary>
|
||||
[Fact]
|
||||
public void Flatten_SameTemplateComposedTwice_ResolvesNestedMembersUnderBothSlots()
|
||||
{
|
||||
@@ -1076,6 +1111,7 @@ public class FlatteningServiceTests
|
||||
Assert.Contains(result.Value.NativeAlarmSources, s => s.CanonicalName == "x.y2.z.Src");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that flattening a composition cycle still terminates.</summary>
|
||||
[Fact]
|
||||
public void Flatten_CompositionCycle_StillTerminates()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user