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:
@@ -15,8 +15,8 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Bundle E (M2 Task E1) DI surface tests for <c>AddAuditLog</c>. M1 shipped
|
||||
/// the options-only scaffold; M2 extends it with the site writer chain
|
||||
/// DI surface tests for <c>AddAuditLog</c>. The initial version was an
|
||||
/// options-only scaffold; it was then extended with the site writer chain
|
||||
/// (<see cref="SqliteAuditWriter"/> + <see cref="RingBufferFallback"/> +
|
||||
/// <see cref="FallbackAuditWriter"/>) and the telemetry collaborators
|
||||
/// (<see cref="ISiteAuditQueue"/>, <see cref="ISiteStreamAuditClient"/>,
|
||||
@@ -41,6 +41,8 @@ public class AddAuditLogTests
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers the audit log options.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_RegistersAuditLogOptions()
|
||||
{
|
||||
@@ -52,6 +54,8 @@ public class AddAuditLogTests
|
||||
Assert.NotNull(opts!.Value);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog throws when the service collection is null.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_NullServices_Throws()
|
||||
{
|
||||
@@ -61,6 +65,8 @@ public class AddAuditLogTests
|
||||
() => ServiceCollectionExtensions.AddAuditLog(null!, config));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog throws when the configuration is null.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_NullConfig_Throws()
|
||||
{
|
||||
@@ -70,8 +76,10 @@ public class AddAuditLogTests
|
||||
() => services.AddAuditLog(null!));
|
||||
}
|
||||
|
||||
// -- Bundle E (M2 Task E1) ---------------------------------------------
|
||||
// -- Site writer chain DI registrations ---------------------------------------------
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers the SQLite audit writer as a singleton resolvable from DI.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_SqliteAuditWriter_Singleton_FromDI()
|
||||
{
|
||||
@@ -90,6 +98,8 @@ public class AddAuditLogTests
|
||||
Assert.Same(writer, provider.GetService<SqliteAuditWriter>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers IAuditWriter as the fallback audit writer.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_IAuditWriter_AsFallbackAuditWriter()
|
||||
{
|
||||
@@ -104,6 +114,8 @@ public class AddAuditLogTests
|
||||
Assert.IsType<FallbackAuditWriter>(writer);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers ISiteAuditQueue as the same instance as the SQLite audit writer.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_ISiteAuditQueue_AsSameInstance_As_SqliteAuditWriter()
|
||||
{
|
||||
@@ -123,6 +135,8 @@ public class AddAuditLogTests
|
||||
Assert.Same(writer, queue);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers the ring-buffer fallback as a singleton.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_RingBufferFallback_Singleton()
|
||||
{
|
||||
@@ -136,6 +150,8 @@ public class AddAuditLogTests
|
||||
Assert.Same(ring, provider.GetService<RingBufferFallback>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers a no-op audit write failure counter by default.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_AuditWriteFailureCounter_AsNoOpDefault()
|
||||
{
|
||||
@@ -149,6 +165,8 @@ public class AddAuditLogTests
|
||||
Assert.IsType<NoOpAuditWriteFailureCounter>(counter);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers a no-op site stream audit client by default.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_SiteStreamAuditClient_AsNoOpDefault()
|
||||
{
|
||||
@@ -162,8 +180,10 @@ public class AddAuditLogTests
|
||||
Assert.IsType<NoOpSiteStreamAuditClient>(client);
|
||||
}
|
||||
|
||||
// -- M4 Bundle B (B1) central direct-write audit writer -----------------
|
||||
// -- Central direct-write audit writer -----------------
|
||||
|
||||
/// <summary>Verifies that AddAuditLog registers ICentralAuditWriter as the central audit writer.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Registers_ICentralAuditWriter_AsCentralAuditWriter()
|
||||
{
|
||||
@@ -177,6 +197,8 @@ public class AddAuditLogTests
|
||||
Assert.IsType<CentralAuditWriter>(writer);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the ICentralAuditWriter registration is a singleton.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_ICentralAuditWriter_IsSingleton()
|
||||
{
|
||||
@@ -190,6 +212,8 @@ public class AddAuditLogTests
|
||||
Assert.Same(w1, w2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the SQLite writer options bind from configuration and round-trip.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Options_Bind_RoundTrip_SqliteWriter()
|
||||
{
|
||||
@@ -208,6 +232,8 @@ public class AddAuditLogTests
|
||||
Assert.Equal(75, opts.FlushIntervalMs);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the site telemetry options bind from configuration and round-trip.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLog_Options_Bind_RoundTrip_SiteTelemetry()
|
||||
{
|
||||
@@ -224,8 +250,10 @@ public class AddAuditLogTests
|
||||
Assert.Equal(60, opts.IdleIntervalSeconds);
|
||||
}
|
||||
|
||||
// -- Bundle G (M2 Task G1) Site Health Monitoring bridge ----------------
|
||||
// -- Site Health Monitoring bridge ----------------
|
||||
|
||||
/// <summary>Verifies that the health metrics bridge swaps the failure counter for the health metrics implementation.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLogHealthMetricsBridge_Swaps_FailureCounter_To_HealthMetrics_Implementation()
|
||||
{
|
||||
@@ -251,6 +279,8 @@ public class AddAuditLogTests
|
||||
Assert.IsType<HealthMetricsAuditWriteFailureCounter>(counter);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the health metrics bridge still resolves without health monitoring but errors when used.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLogHealthMetricsBridge_Without_HealthMonitoring_Still_Resolves_But_Errors_On_Use()
|
||||
{
|
||||
@@ -276,10 +306,12 @@ public class AddAuditLogTests
|
||||
() => provider.GetRequiredService<IAuditWriteFailureCounter>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that registering the health metrics bridge twice does not register the hosted service twice.</summary>
|
||||
/// <returns>The result.</returns>
|
||||
[Fact]
|
||||
public void AddAuditLogHealthMetricsBridge_IsIdempotent_DoesNotDoubleRegister_HostedService()
|
||||
{
|
||||
// AuditLog-011: AddHostedService has no TryAdd variant, so a second
|
||||
// AddHostedService has no TryAdd variant, so a second
|
||||
// call without the sentinel guard would spin up a second
|
||||
// SiteAuditBacklogReporter on the same SQLite file. The helper must
|
||||
// be a no-op on the second call — exactly one hosted-service
|
||||
|
||||
Reference in New Issue
Block a user