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:
+25
-6
@@ -13,7 +13,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||||
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Bundle D (M5-T8) tests for hot-reloadable <see cref="AuditLogOptions"/>
|
||||
/// Tests for hot-reloadable <see cref="AuditLogOptions"/>
|
||||
/// binding. The first test pins the JSON-realistic binding shape end-to-end
|
||||
/// (scalars, lists, per-target overrides) so accidental drift in the section
|
||||
/// layout breaks the build. The second test exercises the live hot-reload
|
||||
@@ -23,13 +23,14 @@ namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Configuration;
|
||||
/// flowing through without a restart.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Distinct from <see cref="AuditLogOptionsTests"/> (M1-T9) which covered
|
||||
/// Distinct from <see cref="AuditLogOptionsTests"/> which covered
|
||||
/// section binding + validator failures via single-key in-memory config — those
|
||||
/// tests exist; these add (a) end-to-end binding from a realistic JSON literal
|
||||
/// and (b) the hot-reload behavioural contract the M5-T8 spec calls out.
|
||||
/// and (b) the hot-reload behavioural contract the spec calls out.
|
||||
/// </remarks>
|
||||
public class AuditLogOptionsBindingTests
|
||||
{
|
||||
/// <summary>Verifies that the AuditLog configuration section binds every field.</summary>
|
||||
[Fact]
|
||||
public void AuditLog_Section_Binds_AllFields()
|
||||
{
|
||||
@@ -71,7 +72,7 @@ public class AuditLogOptionsBindingTests
|
||||
|
||||
// HeaderRedactList: the Microsoft.Extensions.Configuration list binder
|
||||
// APPENDS to the default list, so we assert containment rather than
|
||||
// exact equality (see M1-T9 AuditLogOptionsTests for the rationale).
|
||||
// exact equality (see AuditLogOptionsTests for the rationale).
|
||||
Assert.Contains("Authorization", opts.HeaderRedactList);
|
||||
Assert.Contains("Custom-Token", opts.HeaderRedactList);
|
||||
|
||||
@@ -90,10 +91,11 @@ public class AuditLogOptionsBindingTests
|
||||
Assert.Equal("@token|@secret", ov.RedactSqlParamsMatching);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the purge options bind from the documented section and keys.</summary>
|
||||
[Fact]
|
||||
public void PurgeOptions_Bind_FromDocumentedSectionAndKeys()
|
||||
{
|
||||
// AuditLog-013: the design doc (Component-AuditLog.md §Configuration)
|
||||
// The design doc (Component-AuditLog.md §Configuration)
|
||||
// documents the purge tuning as the nested `AuditLog:Purge` section with
|
||||
// keys `IntervalHours` + `ChannelPurgeBatchSize`. This test pins that the
|
||||
// code binds from EXACTLY that shape — the section path the production
|
||||
@@ -139,6 +141,7 @@ public class AuditLogOptionsBindingTests
|
||||
Assert.Equal(1000, opts.ChannelPurgeBatchSize);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the filter behavior updates when the configuration reloads.</summary>
|
||||
[Fact]
|
||||
public void Filter_Behavior_Updates_OnConfigReload()
|
||||
{
|
||||
@@ -165,7 +168,7 @@ public class AuditLogOptionsBindingTests
|
||||
Assert.True(Encoding.UTF8.GetByteCount(resultBefore.AsRow().RequestSummary!) <= 4096);
|
||||
|
||||
// Reload: cap raised to 16384 — next event must NOT truncate. This is
|
||||
// the M5-T8 contract: the filter sees the new value on the very next
|
||||
// the hot-reload contract: the filter sees the new value on the very next
|
||||
// Apply, without process restart.
|
||||
monitor.Set(new AuditLogOptions { DefaultCapBytes = 16384 });
|
||||
|
||||
@@ -174,6 +177,7 @@ public class AuditLogOptionsBindingTests
|
||||
Assert.Equal(body, resultAfter.AsRow().RequestSummary);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the filter picks up a new body redactor when the configuration reloads.</summary>
|
||||
[Fact]
|
||||
public void Filter_PicksUp_NewBodyRedactor_OnConfigReload()
|
||||
{
|
||||
@@ -219,12 +223,21 @@ public class AuditLogOptionsBindingTests
|
||||
private T _current;
|
||||
private readonly List<Action<T, string?>> _listeners = new();
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>TestOptionsMonitor</c> class.</summary>
|
||||
/// <param name="initial">The initial.</param>
|
||||
public TestOptionsMonitor(T initial) => _current = initial;
|
||||
|
||||
/// <summary>Gets the current value value.</summary>
|
||||
public T CurrentValue => _current;
|
||||
|
||||
/// <summary>Returns the current options value regardless of the name.</summary>
|
||||
/// <param name="name">The options name; ignored.</param>
|
||||
/// <returns>The current options value.</returns>
|
||||
public T Get(string? name) => _current;
|
||||
|
||||
/// <summary>Registers a listener to be notified when the options change.</summary>
|
||||
/// <param name="listener">The change callback.</param>
|
||||
/// <returns>A disposable that removes the listener, or null when none is tracked.</returns>
|
||||
public IDisposable? OnChange(Action<T, string?> listener)
|
||||
{
|
||||
lock (_listeners)
|
||||
@@ -234,6 +247,8 @@ public class AuditLogOptionsBindingTests
|
||||
return new Unsubscribe(_listeners, listener);
|
||||
}
|
||||
|
||||
/// <summary>Replaces the current value and notifies registered listeners.</summary>
|
||||
/// <param name="value">The value.</param>
|
||||
public void Set(T value)
|
||||
{
|
||||
_current = value;
|
||||
@@ -252,11 +267,15 @@ public class AuditLogOptionsBindingTests
|
||||
{
|
||||
private readonly List<Action<T, string?>> _listeners;
|
||||
private readonly Action<T, string?> _listener;
|
||||
/// <summary>Initializes a new instance of the <c>Unsubscribe</c> class.</summary>
|
||||
/// <param name="listeners">The listeners.</param>
|
||||
/// <param name="listener">The listener.</param>
|
||||
public Unsubscribe(List<Action<T, string?>> listeners, Action<T, string?> listener)
|
||||
{
|
||||
_listeners = listeners;
|
||||
_listener = listener;
|
||||
}
|
||||
/// <summary>Releases the resources held by the test fixture.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
lock (_listeners)
|
||||
|
||||
Reference in New Issue
Block a user