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:
@@ -7,7 +7,7 @@ using ZB.MOM.WW.ScadaBridge.TestSupport;
|
||||
namespace ZB.MOM.WW.ScadaBridge.StoreAndForward.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// M1.7: the StoreAndForwardService emits site operational events for its own
|
||||
/// The StoreAndForwardService emits site operational events for its own
|
||||
/// buffer/park activity — <c>store_and_forward</c> for cached-call categories
|
||||
/// (ExternalSystem / CachedDbWrite) and <c>notification</c> for the site's
|
||||
/// notification forward-to-central path. Emission rides the existing
|
||||
@@ -21,9 +21,14 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
private sealed class FakeSiteEventLogger : ISiteEventLogger
|
||||
{
|
||||
private readonly ConcurrentQueue<Entry> _entries = new();
|
||||
/// <summary>Gets the entries logged so far.</summary>
|
||||
public IReadOnlyList<Entry> Entries => _entries.ToArray();
|
||||
/// <summary>Returns the logged entries of one event type.</summary>
|
||||
/// <param name="t">The event type to filter by.</param>
|
||||
/// <returns>The logged entries whose event type matches.</returns>
|
||||
public IReadOnlyList<Entry> OfType(string t) => _entries.Where(e => e.EventType == t).ToArray();
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task LogEventAsync(string eventType, string severity, string? instanceId,
|
||||
string source, string message, string? details = null)
|
||||
{
|
||||
@@ -31,6 +36,7 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public long FailedWriteCount => 0;
|
||||
}
|
||||
|
||||
@@ -40,6 +46,7 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
private readonly FakeSiteEventLogger _siteLog = new();
|
||||
private readonly StoreAndForwardService _service;
|
||||
|
||||
/// <summary>Initializes the test class with a temporary LocalDb and a store-and-forward service wired to a fake site event logger.</summary>
|
||||
public StoreAndForwardSiteEventTests()
|
||||
{
|
||||
_localDb = TestLocalDb.CreateTemp("SiteEvt");
|
||||
@@ -58,8 +65,13 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
siteEventLogger: _siteLog);
|
||||
}
|
||||
|
||||
/// <summary>Initializes the fixture before the tests run.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task InitializeAsync() => await _storage.InitializeAsync();
|
||||
/// <summary>Releases the fixture after the tests run.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task DisposeAsync() => Task.CompletedTask;
|
||||
/// <summary>Releases the resources held by the test fixture.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
var path = _localDb.Path;
|
||||
@@ -67,6 +79,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
TestLocalDb.DeleteFiles(path);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that buffering an external system message for retry emits a store-and-forward site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task BufferForRetry_ExternalSystem_EmitsStoreAndForwardSiteEvent()
|
||||
{
|
||||
@@ -83,6 +97,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(_siteLog.OfType("notification"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a failed notification forward emits a notification site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ForwardFailure_Notification_EmitsNotificationSiteEvent()
|
||||
{
|
||||
@@ -103,6 +119,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(_siteLog.OfType("store_and_forward"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a routine notification enqueue does not emit a site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RoutineEnqueue_Notification_DoesNotEmitSiteEvent()
|
||||
{
|
||||
@@ -117,6 +135,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(_siteLog.OfType("notification"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parking a notification emits an error-severity notification site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Park_Notification_EmitsErrorNotificationSiteEvent()
|
||||
{
|
||||
@@ -136,6 +156,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
r.Message.Contains("parked", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that parking an external system message emits an error-severity store-and-forward site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Park_ExternalSystem_EmitsErrorStoreAndForwardSiteEvent()
|
||||
{
|
||||
@@ -154,6 +176,8 @@ public class StoreAndForwardSiteEventTests : IAsyncLifetime, IDisposable
|
||||
r.Message.Contains("parked", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a message delivered immediately does not emit a site event.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeliveredImmediately_DoesNotEmitSiteEvent()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user