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:
+36
-3
@@ -89,13 +89,24 @@ public class DeploymentServiceStalenessTests
|
||||
/// <summary>Every entry logged, in order.</summary>
|
||||
public List<(LogLevel Level, string Message)> Entries { get; } = [];
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Begins a logical scope; this capturing logger does not track scopes.</summary>
|
||||
/// <typeparam name="TState">The type of the scope state.</typeparam>
|
||||
/// <param name="state">The scope state.</param>
|
||||
/// <returns>Always <see langword="null"/>.</returns>
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Reports whether a log level is enabled; every level is.</summary>
|
||||
/// <param name="logLevel">The log level to check.</param>
|
||||
/// <returns>Always <see langword="true"/>.</returns>
|
||||
public bool IsEnabled(LogLevel logLevel) => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Records the level and formatted message in <see cref="Entries"/>.</summary>
|
||||
/// <typeparam name="TState">The type of the log state.</typeparam>
|
||||
/// <param name="logLevel">The severity of the entry.</param>
|
||||
/// <param name="eventId">The event id of the entry.</param>
|
||||
/// <param name="state">The log state.</param>
|
||||
/// <param name="exception">The exception associated with the entry, if any.</param>
|
||||
/// <param name="formatter">Formats the state and exception into the message.</param>
|
||||
public void Log<TState>(
|
||||
LogLevel logLevel,
|
||||
EventId eventId,
|
||||
@@ -135,6 +146,8 @@ public class DeploymentServiceStalenessTests
|
||||
_repo.GetDeployedRevisionHashesAsync(Arg.Any<CancellationToken>())
|
||||
.Returns(rows.ToDictionary(r => r.InstanceId, r => r.Hash));
|
||||
|
||||
/// <summary>Verifies that the staleness check shares one flatten session across the whole batch.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_SharesOneSessionAcrossTheBatch()
|
||||
{
|
||||
@@ -156,6 +169,8 @@ public class DeploymentServiceStalenessTests
|
||||
await _pipeline.Received(1).FlattenAndValidateAsync(3, Arg.Any<CancellationToken>(), false, _session);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a matching hash is reported as not stale and no snapshot is read.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_HashMatches_NotStaleAndNoSnapshotRead()
|
||||
{
|
||||
@@ -172,6 +187,8 @@ public class DeploymentServiceStalenessTests
|
||||
await _repo.DidNotReceive().GetDeployedSnapshotByInstanceIdAsync(1, Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an old-form list snapshot is normalised to not stale.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_OldFormListSnapshot_NormalisesToNotStale()
|
||||
{
|
||||
@@ -214,6 +231,8 @@ public class DeploymentServiceStalenessTests
|
||||
await _repo.Received(1).GetDeployedSnapshotByInstanceIdAsync(50, Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a genuine hash mismatch is reported as stale.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_GenuineMismatch_IsStale()
|
||||
{
|
||||
@@ -231,6 +250,8 @@ public class DeploymentServiceStalenessTests
|
||||
Assert.True(result[1]);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a failing flatten is reported with unknown staleness.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_FlattenFails_ReportsUnknown()
|
||||
{
|
||||
@@ -246,6 +267,8 @@ public class DeploymentServiceStalenessTests
|
||||
Assert.Null(result[1]);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that many flatten failures log exactly one warning.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_ManyFlattenFailures_LogsExactlyOneWarning()
|
||||
{
|
||||
@@ -274,6 +297,8 @@ public class DeploymentServiceStalenessTests
|
||||
Assert.Equal(2, _logger.Entries.Count(e => e.Level == LogLevel.Debug));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that no flatten failures log no warning.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_NoFailures_LogsNoWarning()
|
||||
{
|
||||
@@ -287,6 +312,8 @@ public class DeploymentServiceStalenessTests
|
||||
Assert.DoesNotContain(_logger.Entries, e => e.Level == LogLevel.Warning);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance without a snapshot is omitted from the result.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_InstanceWithoutSnapshot_IsOmitted()
|
||||
{
|
||||
@@ -304,6 +331,8 @@ public class DeploymentServiceStalenessTests
|
||||
2, Arg.Any<CancellationToken>(), Arg.Any<bool>(), Arg.Any<FlattenSession?>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance whose snapshot vanishes between reads is omitted from the result.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_SnapshotVanishedBetweenReads_IsOmitted()
|
||||
{
|
||||
@@ -319,6 +348,8 @@ public class DeploymentServiceStalenessTests
|
||||
Assert.False(result.ContainsKey(1));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that duplicate instance ids are flattened only once.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_DuplicateIds_FlattenedOnce()
|
||||
{
|
||||
@@ -334,6 +365,8 @@ public class DeploymentServiceStalenessTests
|
||||
1, Arg.Any<CancellationToken>(), Arg.Any<bool>(), Arg.Any<FlattenSession?>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that empty input returns an empty result without any reads.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetInstanceStalenessAsync_EmptyInput_ReturnsEmptyWithoutReads()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user