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:
+18
-3
@@ -6,7 +6,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// In-memory batch-capable <see cref="IDataConnection"/> for the WP2.1b seam tests. It
|
||||
/// In-memory batch-capable <see cref="IDataConnection"/> for the batch seam tests. It
|
||||
/// records every batch call (so "one round trip per chunk, not per tag" is assertable),
|
||||
/// can fail individual tags or a whole batch, and can hang its bulk read so the seed
|
||||
/// deadline is observable.
|
||||
@@ -55,15 +55,17 @@ public sealed class FakeBatchDataConnection
|
||||
/// <summary>Callback the last alarm subscribe registered.</summary>
|
||||
public AlarmTransitionCallback? AlarmCallback;
|
||||
|
||||
// Fake behaviour: Gets the simulated connection health, which follows connect and disconnect calls.
|
||||
/// <inheritdoc />
|
||||
public ConnectionHealth Status { get; private set; } = ConnectionHealth.Disconnected;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Occurs when the fake raises a simulated transport fault.</summary>
|
||||
public event Action? Disconnected;
|
||||
|
||||
/// <summary>Raises <see cref="Disconnected"/> as a real adapter would on a transport fault.</summary>
|
||||
public void RaiseDisconnected() => Disconnected?.Invoke();
|
||||
|
||||
// Fake behaviour: Marks the fake as connected.
|
||||
/// <inheritdoc />
|
||||
public Task ConnectAsync(IDictionary<string, string> connectionDetails, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -71,6 +73,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Marks the fake as disconnected.
|
||||
/// <inheritdoc />
|
||||
public Task DisconnectAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -78,6 +81,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the batch, captures the callback and returns a per-tag result, failing the tags configured to fail.
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<TagSubscribeResult>> SubscribeBatchAsync(
|
||||
IReadOnlyList<string> tagPaths, SubscriptionCallback callback, CancellationToken cancellationToken = default)
|
||||
@@ -100,6 +104,7 @@ public sealed class FakeBatchDataConnection
|
||||
return rows;
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the subscription ids passed to the batch unsubscribe.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeBatchAsync(IReadOnlyList<string> subscriptionIds, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -107,6 +112,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Counts the single-tag subscribe call and captures the callback.
|
||||
/// <inheritdoc />
|
||||
public Task<string> SubscribeAsync(string tagPath, SubscriptionCallback callback, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -115,10 +121,12 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.FromResult($"sub-{Interlocked.Increment(ref _nextId)}");
|
||||
}
|
||||
|
||||
// Fake behaviour: Completes without doing anything.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeAsync(string subscriptionId, CancellationToken cancellationToken = default)
|
||||
=> Task.CompletedTask;
|
||||
|
||||
// Fake behaviour: Counts the single-tag read and returns the seed value, or hangs when reads are configured to hang.
|
||||
/// <inheritdoc />
|
||||
public async Task<ReadResult> ReadAsync(string tagPath, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -128,6 +136,7 @@ public sealed class FakeBatchDataConnection
|
||||
return new ReadResult(true, new TagValue(SeedValue, QualityCode.Good, DateTimeOffset.UtcNow), null);
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the batch read and returns the seed value for every tag, or hangs when reads are configured to hang.
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyDictionary<string, ReadResult>> ReadBatchAsync(
|
||||
IEnumerable<string> tagPaths, CancellationToken cancellationToken = default)
|
||||
@@ -142,22 +151,26 @@ public sealed class FakeBatchDataConnection
|
||||
t => new ReadResult(true, new TagValue(SeedValue, QualityCode.Good, DateTimeOffset.UtcNow), null));
|
||||
}
|
||||
|
||||
// Fake behaviour: Reports a successful write without storing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<WriteResult> WriteAsync(string tagPath, object? value, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(new WriteResult(true, null));
|
||||
|
||||
// Fake behaviour: Reports a successful write for every entry without storing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyDictionary<string, WriteResult>> WriteBatchAsync(
|
||||
IDictionary<string, object?> values, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<IReadOnlyDictionary<string, WriteResult>>(
|
||||
values.ToDictionary(kv => kv.Key, _ => new WriteResult(true, null)));
|
||||
|
||||
// Fake behaviour: Reports that the handshake matched without writing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<bool> WriteBatchAndWaitAsync(
|
||||
IDictionary<string, object?> values, string flagPath, object? flagValue, string responsePath,
|
||||
object? responseValue, TimeSpan timeout, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(true);
|
||||
|
||||
// Fake behaviour: Captures the alarm callback and returns a generated subscription id.
|
||||
/// <inheritdoc />
|
||||
public Task<string> SubscribeAlarmsAsync(
|
||||
string sourceReference, string? conditionFilter, AlarmTransitionCallback callback,
|
||||
@@ -167,10 +180,12 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.FromResult($"alarm-{Interlocked.Increment(ref _nextId)}");
|
||||
}
|
||||
|
||||
// Fake behaviour: Completes without doing anything.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeAlarmsAsync(string subscriptionId, CancellationToken cancellationToken = default)
|
||||
=> Task.CompletedTask;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Completes immediately because the fake holds no resources.</summary>
|
||||
/// <returns>A completed value task.</returns>
|
||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user