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:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -20,12 +20,27 @@ public class ScriptLoggerTests
/// <summary>A minimal recording <see cref="ILogger"/> — clearer here than a mocking framework.</summary>
private sealed class RecordingLogger(bool enabled = true) : ILogger
{
/// <summary>Gets the entries recorded so far.</summary>
public List<LogEntry> Entries { get; } = [];
/// <summary>Returns no scope because the fake does not track scopes.</summary>
/// <typeparam name="TState">The type of the state object.</typeparam>
/// <param name="state">The scope or log state.</param>
/// <returns>A no-op scope.</returns>
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
/// <summary>Reports whether logging is enabled for the given level.</summary>
/// <param name="logLevel">The log level.</param>
/// <returns>True if the level is enabled; otherwise false.</returns>
public bool IsEnabled(LogLevel logLevel) => enabled;
/// <summary>Records the log entry for later assertions.</summary>
/// <typeparam name="TState">The type of the state object.</typeparam>
/// <param name="level">The log level.</param>
/// <param name="eventId">The event id.</param>
/// <param name="state">The scope or log state.</param>
/// <param name="exception">The exception associated with the entry, if any.</param>
/// <param name="formatter">Formats the state and exception into the message text.</param>
public void Log<TState>(LogLevel level, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) =>
Entries.Add(new LogEntry(level, formatter(state, exception), exception));
}
@@ -47,6 +62,7 @@ public class ScriptLoggerTests
return (logger, node, rows);
}
/// <summary>Verifies that an untraced run forwards to the node logger and emits no row.</summary>
[Fact]
public void UntracedRun_ForwardsToTheNodeLogger_AndEmitsNoRow()
{
@@ -64,6 +80,7 @@ public class ScriptLoggerTests
Assert.Equal(LogLevel.Warning, node.Entries[1].Level);
}
/// <summary>Verifies that a traced run emits one script-sourced row per line.</summary>
[Fact]
public void TracedRun_EmitsOneScriptSourcedRowPerLine()
{
@@ -76,6 +93,7 @@ public class ScriptLoggerTests
Assert.Equal(("info", "script", "msg", (Exception?)null, (Guid?)null), (row.Level, row.Source, row.Message, row.Exception, row.StepEventId));
}
/// <summary>Verifies that every log level maps to its wire name.</summary>
[Fact]
public void EveryLevel_MapsToItsWireName()
{
@@ -92,6 +110,7 @@ public class ScriptLoggerTests
node.Entries.Select(e => e.Level));
}
/// <summary>Verifies that a line inside a step scope is attributed to that step and the scope unwinds afterwards.</summary>
[Fact]
public void LineInsideAStepScope_IsAttributedToThatStep_AndTheScopeUnwinds()
{
@@ -112,6 +131,7 @@ public class ScriptLoggerTests
Assert.Null(rows[1].StepEventId);
}
/// <summary>Verifies that nested step scopes unwind to the enclosing step.</summary>
[Fact]
public void NestedStepScopes_Unwind_ToTheEnclosingStep()
{
@@ -138,6 +158,7 @@ public class ScriptLoggerTests
Assert.Equal(outer, rows[1].StepEventId);
}
/// <summary>Verifies that lines past the per-run cap are dropped and flushing names the dropped count exactly once.</summary>
[Fact]
public void PastThePerRunCap_LinesAreDropped_AndFlushDroppedNamesTheCount_Once()
{
@@ -159,7 +180,7 @@ public class ScriptLoggerTests
var closing = rows[^1];
Assert.Equal("warn", closing.Level);
Assert.Equal("runtime", closing.Source);
// M3: worded identically to the central InboundScriptLogger closing row.
// Worded identically to the central InboundScriptLogger closing row.
Assert.Contains("2 further log line(s) were not captured", closing.Message);
Assert.Contains("ScadaBridge:SiteRuntime:MaxLogLinesPerRun = 3", closing.Message);
Assert.Null(closing.StepEventId);
@@ -169,6 +190,7 @@ public class ScriptLoggerTests
Assert.Equal(4, rows.Count);
}
/// <summary>Verifies that flushing emits nothing when no line was dropped.</summary>
[Fact]
public void FlushDropped_EmitsNothing_WhenNoLineWasDropped()
{
@@ -180,6 +202,7 @@ public class ScriptLoggerTests
Assert.Single(rows);
}
/// <summary>Verifies that messages longer than the cap are clipped with an ellipsis.</summary>
[Fact]
public void MessagesLongerThanTheCap_AreClippedWithAnEllipsis()
{
@@ -192,6 +215,7 @@ public class ScriptLoggerTests
Assert.EndsWith("…", message);
}
/// <summary>Verifies that a message exactly at the cap passes through unclipped.</summary>
[Fact]
public void AMessageExactlyAtTheCap_PassesThroughUnclipped()
{
@@ -203,6 +227,7 @@ public class ScriptLoggerTests
Assert.Equal(exact, Assert.Single(rows).Message);
}
/// <summary>Verifies that a surrogate pair straddling the cap is dropped whole.</summary>
[Fact]
public void ASurrogatePairStraddlingTheCap_IsDroppedWhole()
{
@@ -219,6 +244,7 @@ public class ScriptLoggerTests
Assert.DoesNotContain(message, static c => char.IsSurrogate(c));
}
/// <summary>Verifies that a throwing emitter never reaches the script and the node logger still gets the line.</summary>
[Fact]
public void AThrowingEmitter_NeverReachesTheScript_AndTheNodeLoggerStillGotTheLine()
{
@@ -238,6 +264,7 @@ public class ScriptLoggerTests
Assert.Contains("still logged", node.Entries[0].Message);
}
/// <summary>Verifies that a throwing node logger never reaches the script and the row is still emitted.</summary>
[Fact]
public void AThrowingNodeLogger_NeverReachesTheScript_AndTheRowIsStillEmitted()
{
@@ -258,14 +285,29 @@ public class ScriptLoggerTests
/// <summary>A node logger whose sink fails, standing in for a wedged Serilog sink.</summary>
private sealed class ThrowingLogger : ILogger
{
/// <summary>Returns no scope because the fake does not track scopes.</summary>
/// <typeparam name="TState">The type of the state object.</typeparam>
/// <param name="state">The scope or log state.</param>
/// <returns>A no-op scope.</returns>
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
/// <summary>Reports whether logging is enabled for the given level.</summary>
/// <param name="logLevel">The log level.</param>
/// <returns>True if the level is enabled; otherwise false.</returns>
public bool IsEnabled(LogLevel logLevel) => true;
/// <summary>Throws to simulate a failing log sink.</summary>
/// <typeparam name="TState">The type of the state object.</typeparam>
/// <param name="level">The log level.</param>
/// <param name="eventId">The event id.</param>
/// <param name="state">The scope or log state.</param>
/// <param name="exception">The exception associated with the entry, if any.</param>
/// <param name="formatter">Formats the state and exception into the message text.</param>
public void Log<TState>(LogLevel level, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) =>
throw new InvalidOperationException("sink is down");
}
/// <summary>Verifies that an attached exception reaches both the node logger and the row.</summary>
[Fact]
public void AnAttachedException_ReachesBothTheNodeLoggerAndTheRow()
{
@@ -278,6 +320,7 @@ public class ScriptLoggerTests
Assert.Same(boom, Assert.Single(rows).Exception);
}
/// <summary>Verifies that runtime lines are row-only and carry the runtime source.</summary>
[Fact]
public void RuntimeLines_AreRowOnly_AndCarryTheRuntimeSource()
{
@@ -293,6 +336,7 @@ public class ScriptLoggerTests
Assert.Equal("runtime", row.Source);
}
/// <summary>Verifies that runtime lines share the per-run cap with script lines.</summary>
[Fact]
public void RuntimeLines_ShareThePerRunCapWithScriptLines()
{
@@ -307,6 +351,7 @@ public class ScriptLoggerTests
Assert.Contains("1 further log line(s) were not captured", rows[^1].Message);
}
/// <summary>Verifies that the maximum line count must be positive.</summary>
[Fact]
public void MaxLinesMustBePositive()
{
@@ -314,6 +359,7 @@ public class ScriptLoggerTests
new ScriptLogger(new RecordingLogger(), emit: null, maxLines: 0, "i", "s", null));
}
/// <summary>Verifies that the node logger is required.</summary>
[Fact]
public void TheNodeLoggerIsRequired()
{