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
@@ -11,6 +11,7 @@ public class EventLogQueryServiceTests : IDisposable
private readonly TestLocalDb _localDb;
private readonly string _dbPath;
/// <summary>Initializes the test class with a temporary LocalDb-backed event logger and query service.</summary>
public EventLogQueryServiceTests()
{
_dbPath = Path.Combine(Path.GetTempPath(), $"test_query_{Guid.NewGuid()}.db");
@@ -27,6 +28,7 @@ public class EventLogQueryServiceTests : IDisposable
NullLogger<EventLogQueryService>.Instance);
}
/// <summary>Releases the resources used by this instance.</summary>
public void Dispose()
{
_eventLogger.Dispose();
@@ -66,6 +68,8 @@ public class EventLogQueryServiceTests : IDisposable
PageSize: pageSize,
Timestamp: DateTimeOffset.UtcNow);
/// <summary>Verifies that a query with no filters returns all events.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_ReturnsAllEvents_WhenNoFilters()
{
@@ -78,6 +82,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.False(response.HasMore);
}
/// <summary>Verifies that a query filters events by event type.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_FiltersByEventType()
{
@@ -90,6 +96,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.All(response.Entries, e => Assert.Equal("script", e.EventType));
}
/// <summary>Verifies that a query filters events by severity.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_FiltersBySeverity()
{
@@ -102,6 +110,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.All(response.Entries, e => Assert.Equal("Error", e.Severity));
}
/// <summary>Verifies that a query filters events by instance id.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_FiltersByInstanceId()
{
@@ -114,6 +124,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.All(response.Entries, e => Assert.Equal("inst-1", e.InstanceId));
}
/// <summary>Verifies that a keyword search matches the event message.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_KeywordSearch_MatchesMessage()
{
@@ -126,6 +138,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Contains("timeout", response.Entries[0].Message, StringComparison.OrdinalIgnoreCase);
}
/// <summary>Verifies that a keyword search matches the event source.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_KeywordSearch_MatchesSource()
{
@@ -138,6 +152,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Contains("AlarmActor", response.Entries[0].Source);
}
/// <summary>Verifies that a query combines multiple filters.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_CombinesMultipleFilters()
{
@@ -153,6 +169,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal("Script timeout", response.Entries[0].Message);
}
/// <summary>Verifies that pagination returns the requested page size.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_Pagination_ReturnsCorrectPageSize()
{
@@ -166,6 +184,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.NotNull(response.ContinuationToken);
}
/// <summary>Verifies that the continuation token retrieves the next page correctly.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_Pagination_ContinuationTokenWorksCorrectly()
{
@@ -198,6 +218,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal(5, allIds.Distinct().Count());
}
/// <summary>Verifies that a query filters events by time range.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_FiltersByTimeRange()
{
@@ -217,10 +239,12 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal(2, response.Entries.Count);
}
/// <summary>Verifies that a time range filter normalises non-UTC offsets correctly.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_FiltersByTimeRange_HandlesNonUtcOffset()
{
// SiteEventLogging-024 (re-opens -016): the store holds UTC ISO-8601 "o"
// The store holds UTC ISO-8601 "o"
// strings (always +00:00) and compares them lexicographically. If the
// From/To bounds are stringified verbatim without UTC normalisation, a
// non-UTC DateTimeOffset from a central client sorts wrongly against the
@@ -253,6 +277,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal(new[] { "MIDDLE" }, response.Entries.Select(e => e.Source).ToArray());
}
/// <summary>Verifies that a query with no matches returns an empty result.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_EmptyResult_WhenNoMatches()
{
@@ -266,6 +292,7 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Null(response.ContinuationToken);
}
/// <summary>Verifies that a query returns the correlation id of each event.</summary>
[Fact]
public void Query_ReturnsCorrelationId()
{
@@ -276,6 +303,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal("site-1", response.SiteId);
}
/// <summary>Verifies that a query returns every field of the event log entry.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_ReturnsAllEventLogEntryFields()
{
@@ -294,10 +323,12 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal("{\"stack\":\"trace\"}", entry.Details);
}
/// <summary>Verifies that a keyword search treats an underscore as a literal rather than a wildcard.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_KeywordSearch_TreatsUnderscoreAsLiteral_NotWildcard()
{
// SiteEventLogging-013: a SQL LIKE '_' matches any single character. A
// A SQL LIKE '_' matches any single character. A
// keyword search for a literal underscore (common in identifiers such as
// "store_and_forward") must NOT match strings that merely have any
// character in that position.
@@ -311,10 +342,12 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Equal("store_and_forward", response.Entries[0].Source);
}
/// <summary>Verifies that a keyword search treats a percent sign as a literal rather than a wildcard.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_KeywordSearch_TreatsPercentAsLiteral_NotWildcard()
{
// SiteEventLogging-013: a SQL LIKE '%' matches any run of characters. A
// A SQL LIKE '%' matches any run of characters. A
// keyword search containing a literal '%' must match only the literal.
await _eventLogger.LogEventAsync("script", "Warning", null, "ScriptActor:Run", "CPU at 90% utilisation");
await _eventLogger.LogEventAsync("script", "Warning", null, "ScriptActor:Run", "CPU at 90 then 0 utilisation");
@@ -326,6 +359,8 @@ public class EventLogQueryServiceTests : IDisposable
Assert.Contains("90% utilisation", response.Entries[0].Message);
}
/// <summary>Verifies that a keyword search still matches a plain substring.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_KeywordSearch_StillMatchesPlainSubstring()
{
@@ -358,8 +393,10 @@ public class EventLogQueryServiceTests : IDisposable
});
}
// --- SiteEventLogging-017: PageSize hard upper bound ---
// --- PageSize hard upper bound ---
/// <summary>Verifies that a requested page size is clamped to the maximum query page size.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Query_PageSize_IsClampedToMaxQueryPageSize()
{