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:
@@ -6,9 +6,10 @@ namespace ZB.MOM.WW.ScadaBridge.TemplateEngine.Tests;
|
||||
public class TemplateResolverTests
|
||||
{
|
||||
// ========================================================================
|
||||
// WP-7: Path-Qualified Canonical Naming
|
||||
// Path-Qualified Canonical Naming
|
||||
// ========================================================================
|
||||
|
||||
/// <summary>Verifies that direct members are resolved without a prefix.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_DirectMembers_NoPrefix()
|
||||
{
|
||||
@@ -26,6 +27,7 @@ public class TemplateResolverTests
|
||||
Assert.Contains(members, m => m.CanonicalName == "OnStart" && m.MemberType == "Script");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that members of a composed module are resolved with prefixed names.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_ComposedModule_PrefixedNames()
|
||||
{
|
||||
@@ -42,6 +44,7 @@ public class TemplateResolverTests
|
||||
Assert.Equal("sensor1.Pressure", members[0].CanonicalName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that nested composition produces multi-level prefixes.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_NestedComposition_MultiLevelPrefix()
|
||||
{
|
||||
@@ -62,9 +65,10 @@ public class TemplateResolverTests
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// WP-10: Inheritance Override Scope
|
||||
// Inheritance Override Scope
|
||||
// ========================================================================
|
||||
|
||||
/// <summary>Verifies that inherited members are included.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_InheritedMembers_Included()
|
||||
{
|
||||
@@ -82,6 +86,7 @@ public class TemplateResolverTests
|
||||
Assert.Contains(members, m => m.CanonicalName == "ExtraAttr");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a child override of a parent member uses the child's version.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_ChildOverridesParentMember_UsesChildVersion()
|
||||
{
|
||||
@@ -105,6 +110,7 @@ public class TemplateResolverTests
|
||||
Assert.Equal(2, speedMember.SourceTemplateId); // Child's version
|
||||
}
|
||||
|
||||
/// <summary>Verifies that inherited composed modules are included.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_InheritedComposedModules_Included()
|
||||
{
|
||||
@@ -123,9 +129,10 @@ public class TemplateResolverTests
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// WP-11: Composition Override Scope
|
||||
// Composition Override Scope
|
||||
// ========================================================================
|
||||
|
||||
/// <summary>Verifies that a composed member is found by its canonical name.</summary>
|
||||
[Fact]
|
||||
public void FindMemberByCanonicalName_ComposedMember_Found()
|
||||
{
|
||||
@@ -143,6 +150,7 @@ public class TemplateResolverTests
|
||||
Assert.False(member.IsLocked);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a locked composed member is reported as locked.</summary>
|
||||
[Fact]
|
||||
public void FindMemberByCanonicalName_LockedComposedMember_ReturnsLocked()
|
||||
{
|
||||
@@ -159,6 +167,7 @@ public class TemplateResolverTests
|
||||
Assert.True(member.IsLocked);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a three-level inheritance chain is returned root first.</summary>
|
||||
[Fact]
|
||||
public void BuildInheritanceChain_ThreeLevel_RootFirst()
|
||||
{
|
||||
@@ -175,16 +184,17 @@ public class TemplateResolverTests
|
||||
Assert.Equal("C", chain[2].Name);
|
||||
}
|
||||
|
||||
// ── TemplateEngine-019: a real Id of 0 must walk the inheritance chain ──
|
||||
// ── A real Id of 0 must walk the inheritance chain ──
|
||||
|
||||
/// <summary>Verifies that a real template id of zero is treated as a parent reference rather than as no parent.</summary>
|
||||
[Fact]
|
||||
public void BuildInheritanceChain_RealIdZero_IsTreatedAsParentReferenceNotAsNoParent()
|
||||
{
|
||||
// TemplateEngine-013 removed the 0-as-no-parent sentinel from
|
||||
// CycleDetector; the same fix had not propagated into the resolver,
|
||||
// The 0-as-no-parent sentinel was removed from
|
||||
// CycleDetector, but the same fix had not propagated into the resolver,
|
||||
// so seeding BuildInheritanceChain with templateId == 0 returned an
|
||||
// empty chain even when a template with Id 0 existed (e.g. an
|
||||
// import-staging row, or any in-memory test setup). Post-019: only a
|
||||
// import-staging row, or any in-memory test setup). Now only a
|
||||
// null ParentTemplateId means "no parent", and an Id of 0 walks the
|
||||
// chain like any other node.
|
||||
var orphaned = new Template("OrphanedId0") { Id = 0 };
|
||||
@@ -198,19 +208,20 @@ public class TemplateResolverTests
|
||||
var lookup = new Dictionary<int, Template> { [0] = orphaned };
|
||||
var chain = TemplateResolver.BuildInheritanceChain(0, lookup);
|
||||
|
||||
// Pre-019: while (currentId != 0 && ...) was false on the first
|
||||
// Previously, while (currentId != 0 && ...) was false on the first
|
||||
// iteration, so the chain was empty and the orphaned template's
|
||||
// members were silently dropped from every flatten/resolve through
|
||||
// it. Post-019: the orphan is the chain.
|
||||
// it. Now the orphan is the chain.
|
||||
Assert.Single(chain);
|
||||
Assert.Equal("OrphanedId0", chain[0].Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a parent chain passing through id zero is not truncated at zero.</summary>
|
||||
[Fact]
|
||||
public void BuildInheritanceChain_ParentChainThroughIdZero_DoesNotTruncateChainAtZero()
|
||||
{
|
||||
// A template whose real parent has Id 0 must include the Id 0 parent
|
||||
// in the chain. Pre-019: `current.ParentTemplateId ?? 0` paired with
|
||||
// in the chain. Previously `current.ParentTemplateId ?? 0` paired with
|
||||
// `currentId != 0` exited the loop as soon as the walk reached a real
|
||||
// Id of 0 — silently truncating the inheritance contribution from the
|
||||
// root template.
|
||||
@@ -231,12 +242,13 @@ public class TemplateResolverTests
|
||||
Assert.Equal("Child", chain[1].Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a template with a real id of zero still resolves its members.</summary>
|
||||
[Fact]
|
||||
public void ResolveAllMembers_TemplateWithRealIdZero_StillResolvesItsMembers()
|
||||
{
|
||||
// End-to-end: ResolveAllMembers piggybacks on BuildInheritanceChain,
|
||||
// so the chain truncation regression also dropped every member of an
|
||||
// Id-0 template from the resolved-member set. Lock this in too.
|
||||
// template with an Id of 0 from the resolved-member set. Lock this in too.
|
||||
var orphan = new Template("OrphanedId0") { Id = 0 };
|
||||
orphan.Attributes.Add(new TemplateAttribute("Speed")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user