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
@@ -14,6 +14,7 @@ public class AuditServiceTests : IDisposable
private readonly AuditCorrelationContext _correlationContext;
private readonly AuditService _auditService;
/// <summary>Initializes the test class with an in-memory SQLite database and an audit service.</summary>
public AuditServiceTests()
{
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
@@ -27,12 +28,15 @@ public class AuditServiceTests : IDisposable
_auditService = new AuditService(_context, _correlationContext);
}
/// <summary>Releases the resources held by the test fixture.</summary>
public void Dispose()
{
_context.Database.CloseConnection();
_context.Dispose();
}
/// <summary>Verifies that logging creates an audit entry committed together with the entity change.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_CreatesAuditEntry_CommittedWithEntityChange()
{
@@ -56,6 +60,8 @@ public class AuditServiceTests : IDisposable
Assert.Single(await _context.Templates.ToListAsync());
}
/// <summary>Verifies that a rollback undoes both the entity change and its audit entry.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_Rollback_BothChangeAndAuditRolledBack()
{
@@ -78,6 +84,8 @@ public class AuditServiceTests : IDisposable
Assert.Empty(await _context.Templates.Where(t => t.Name == "RollbackTemplate").ToListAsync());
}
/// <summary>Verifies that the after-state is serialized as JSON.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_SerializesAfterStateAsJson()
{
@@ -93,6 +101,8 @@ public class AuditServiceTests : IDisposable
Assert.Equal(42, deserialized.GetProperty("Value").GetInt32());
}
/// <summary>Verifies that a null after-state is stored for deletes.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_NullAfterState_ForDeletes()
{
@@ -104,6 +114,8 @@ public class AuditServiceTests : IDisposable
Assert.Equal("Delete", audit.Action);
}
/// <summary>Verifies that the audit timestamp is set to the current UTC time.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_SetsTimestampToUtcNow()
{
@@ -118,6 +130,7 @@ public class AuditServiceTests : IDisposable
Assert.True(audit.Timestamp <= after.AddSeconds(2));
}
/// <summary>Verifies that the audit service is append-only and exposes no update or delete methods.</summary>
[Fact]
public void AuditService_IsAppendOnly_NoUpdateOrDeleteMethods()
{
@@ -128,6 +141,8 @@ public class AuditServiceTests : IDisposable
Assert.DoesNotContain(methods, m => m.Name.Contains("Delete", StringComparison.OrdinalIgnoreCase));
}
/// <summary>Verifies that the bundle import id is stamped from the correlation context.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_StampsBundleImportId_FromCorrelationContext()
{
@@ -145,6 +160,8 @@ public class AuditServiceTests : IDisposable
Assert.Equal(bundleId, audit.BundleImportId);
}
/// <summary>Verifies that the bundle import id stays null when the correlation context has no value.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_LeavesBundleImportIdNull_WhenCorrelationContextHasNoValue()
{
@@ -164,14 +181,18 @@ public class AuditServiceTests : IDisposable
// Self-referential POCO used to reproduce a reference cycle in afterState.
private sealed class CyclicNode
{
/// <summary>Gets or sets the node name.</summary>
public string Name { get; set; } = "node";
/// <summary>Gets or sets the self-referencing node that forms the cycle.</summary>
public CyclicNode? Self { get; set; }
}
/// <summary>Verifies that an after-state containing a reference cycle neither throws nor rolls back the audited operation.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task LogAsync_AfterStateWithReferenceCycle_DoesNotThrow_AndDoesNotRollBackOperation()
{
// Regression guard for ConfigurationDatabase-007: serializing an afterState
// Regression guard for serializing an afterState
// object that contains a reference cycle must not throw a JsonException —
// that would roll back the entire business operation it is auditing.
var node = new CyclicNode();