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:
@@ -16,6 +16,7 @@ namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Scripts;
|
||||
/// </summary>
|
||||
public class ScopeAccessorTests
|
||||
{
|
||||
/// <summary>Verifies that the root scope has an empty self path.</summary>
|
||||
[Fact]
|
||||
public void Root_SelfPath_Empty()
|
||||
{
|
||||
@@ -24,6 +25,7 @@ public class ScopeAccessorTests
|
||||
Assert.False(ScriptScope.Root.HasParent);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a composition scope has a parent scope.</summary>
|
||||
[Fact]
|
||||
public void CompositionScope_HasParent()
|
||||
{
|
||||
@@ -32,6 +34,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("", scope.ParentPath);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an attribute accessor in the root scope resolves a bare key.</summary>
|
||||
[Fact]
|
||||
public void AttributeAccessor_RootScope_ResolvesBareKey()
|
||||
{
|
||||
@@ -39,6 +42,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("Temperature", acc.Resolve("Temperature"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an attribute accessor in a composed scope prepends the composition path.</summary>
|
||||
[Fact]
|
||||
public void AttributeAccessor_ComposedScope_PrependsPath()
|
||||
{
|
||||
@@ -46,6 +50,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("TempSensor.Temperature", acc.Resolve("Temperature"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an attribute accessor in a nested scope chains the full composition path.</summary>
|
||||
[Fact]
|
||||
public void AttributeAccessor_NestedScope_ChainsPath()
|
||||
{
|
||||
@@ -53,6 +58,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("Motor.TempSensor.Temperature", acc.Resolve("Temperature"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that attributes reached through a composition accessor share its scope.</summary>
|
||||
[Fact]
|
||||
public void CompositionAccessor_AttributesShareScope()
|
||||
{
|
||||
@@ -61,6 +67,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("TempSensor", comp.Attributes.ScopePrefix);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that resolving a script through a composition accessor prepends the composition path.</summary>
|
||||
[Fact]
|
||||
public void CompositionAccessor_ResolveScript_PrependsPath()
|
||||
{
|
||||
@@ -68,6 +75,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("TempSensor.Sample", comp.ResolveScript("Sample"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a composition accessor with an empty path leaves the script name bare.</summary>
|
||||
[Fact]
|
||||
public void CompositionAccessor_EmptyPath_LeavesScriptNameBare()
|
||||
{
|
||||
@@ -75,6 +83,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("Sample", comp.ResolveScript("Sample"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a children accessor from the root scope returns a child with no path prefix.</summary>
|
||||
[Fact]
|
||||
public void ChildrenAccessor_FromRoot_GivesUnpathedChild()
|
||||
{
|
||||
@@ -83,6 +92,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("TempSensor", temp.Path);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a children accessor from a composition scope prefixes the child with the composition path.</summary>
|
||||
[Fact]
|
||||
public void ChildrenAccessor_FromComposition_PrefixesChild()
|
||||
{
|
||||
@@ -105,6 +115,7 @@ public class ScopeAccessorTests
|
||||
// These tests verify that contract at the codec level, which is exactly what
|
||||
// the fix makes the accessor invoke.
|
||||
|
||||
/// <summary>Verifies that encoding a list produces a JSON array.</summary>
|
||||
[Fact]
|
||||
public void AttributeValueCodec_Encode_List_ProducesJsonArray()
|
||||
{
|
||||
@@ -115,6 +126,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("[\"a\",\"b\"]", encoded);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that encoding a scalar value passes it through unchanged.</summary>
|
||||
[Fact]
|
||||
public void AttributeValueCodec_Encode_Scalar_PassesThrough()
|
||||
{
|
||||
@@ -124,6 +136,7 @@ public class ScopeAccessorTests
|
||||
Assert.Equal("x", encoded);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that encoding null returns null.</summary>
|
||||
[Fact]
|
||||
public void AttributeValueCodec_Encode_Null_ReturnsNull()
|
||||
{
|
||||
@@ -132,10 +145,11 @@ public class ScopeAccessorTests
|
||||
Assert.Null(AttributeValueCodec.Encode(null));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that encoding an integer list produces a JSON array of numbers.</summary>
|
||||
[Fact]
|
||||
public void AttributeValueCodec_Encode_IntList_ProducesJsonArray()
|
||||
{
|
||||
// Integer list elements encode as native-typed JSON numbers (NJ-1):
|
||||
// Integer list elements encode as native-typed JSON numbers:
|
||||
// [1,2,3], not the old quoted-element form ["1","2","3"].
|
||||
var list = new List<int> { 1, 2, 3 };
|
||||
var encoded = AttributeValueCodec.Encode(list);
|
||||
@@ -164,8 +178,10 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
instanceName: "Pump1",
|
||||
logger: NullLogger<ScriptRuntimeContext>.Instance);
|
||||
|
||||
/// <inheritdoc />
|
||||
void IDisposable.Dispose() => Shutdown();
|
||||
|
||||
/// <summary>Verifies that WaitAsync with a value applies scope resolution before sending the request.</summary>
|
||||
[Fact]
|
||||
public void WaitAsync_Value_AppliesScopeResolution_BeforeSendingRequest()
|
||||
{
|
||||
@@ -188,6 +204,7 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
Assert.Equal("Pump1", req.InstanceName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that WaitAsync with a predicate applies scope resolution and sends the predicate.</summary>
|
||||
[Fact]
|
||||
public void WaitAsync_Predicate_AppliesScopeResolution_AndSendsPredicate()
|
||||
{
|
||||
@@ -206,6 +223,7 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
Assert.NotNull(req.Predicate);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that WaitAsync in the root scope leaves the key bare.</summary>
|
||||
[Fact]
|
||||
public void WaitAsync_RootScope_LeavesKeyBare()
|
||||
{
|
||||
@@ -221,6 +239,8 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
|
||||
// ── WaitForAsync (spec §3): scope resolution + populated WaitResult ───────
|
||||
|
||||
/// <summary>Verifies that WaitForAsync with a value applies scope resolution and surfaces the populated wait result.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WaitForAsync_Value_AppliesScopeResolution_AndSurfacesPopulatedWaitResult()
|
||||
{
|
||||
@@ -250,6 +270,8 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
Assert.False(result.TimedOut);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that WaitForAsync with a predicate applies scope resolution and surfaces the wait result.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WaitForAsync_Predicate_AppliesScopeResolution_AndSurfacesWaitResult()
|
||||
{
|
||||
@@ -274,6 +296,8 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
Assert.Equal(42, result.Value);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that WaitForAsync passes the require-good-quality flag through into the request.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WaitForAsync_RequireGoodQuality_ThreadsFlagIntoRequest()
|
||||
{
|
||||
@@ -295,7 +319,7 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
Assert.Null(result.Value);
|
||||
}
|
||||
|
||||
// ── Reset-aware WriteBatchAndWaitAsync overload (Gitea #36) ──────────────
|
||||
// ── Reset-aware WriteBatchAndWaitAsync overload ──────────────
|
||||
|
||||
/// <summary>
|
||||
/// The reset-aware overload must scope-resolve and codec-encode the reset key/value
|
||||
@@ -304,6 +328,7 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
/// <see cref="HandshakeResult.ResetFailed"/> result WITHOUT writing the batch or
|
||||
/// the trigger (the ExpectNoMsg at the end is that assertion).
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WriteBatchAndWaitAsync_ResetAware_ResolvesScopeAndDefaultsResetTimeout()
|
||||
{
|
||||
@@ -343,7 +368,7 @@ public class AttributeAccessorWaitAsyncTests : TestKit, IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gitea #36 review: a null <c>resetValue</c> would encode to null, which writes an empty
|
||||
/// A null <c>resetValue</c> would encode to null, which writes an empty
|
||||
/// string on leg 1 and then hands the waiter a null target — "any change" — which fast-paths
|
||||
/// on the stale cached value and reinstates exactly the race this overload exists to close.
|
||||
/// The accessor rejects it before anything reaches the InstanceActor.
|
||||
|
||||
Reference in New Issue
Block a user