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:
@@ -32,6 +32,8 @@ public class SiteSecretsCollectorTests
|
||||
UpdatedUtc = DateTimeOffset.Parse("2026-01-02T00:00:00Z"),
|
||||
};
|
||||
|
||||
/// <summary>Verifies that collect returns only referenced rows and names missing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_ReturnsOnlyReferencedRows_AndNamesMissing()
|
||||
{
|
||||
@@ -48,6 +50,8 @@ public class SiteSecretsCollectorTests
|
||||
Assert.Equal(["GW2"], result.Missing[0].ReferencedBy);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect resolved row maps every field from the stored secret verbatim.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_ResolvedRow_MapsEveryFieldFromTheStoredSecretVerbatim()
|
||||
{
|
||||
@@ -74,6 +78,8 @@ public class SiteSecretsCollectorTests
|
||||
Assert.Equal(row.Description, artifact.Description);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect absent name is reported missing not thrown.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_AbsentName_IsReportedMissing_NotThrown()
|
||||
{
|
||||
@@ -88,6 +94,8 @@ public class SiteSecretsCollectorTests
|
||||
Assert.Equal(["GW1"], missing.ReferencedBy);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect no secret references returns empty without querying the store.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_NoSecretReferences_ReturnsEmptyWithoutQueryingTheStore()
|
||||
{
|
||||
@@ -100,10 +108,12 @@ public class SiteSecretsCollectorTests
|
||||
Assert.Empty(result.Missing);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect store throws returns store error instead of throwing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_StoreThrows_ReturnsStoreError_InsteadOfThrowing()
|
||||
{
|
||||
// Final review M5: one site's store read failing must not abort a whole sweep.
|
||||
// One site's store read failing must not abort a whole sweep.
|
||||
var store = new FakeSecretStore(Row("a", 1)) { Fault = new InvalidOperationException("db down") };
|
||||
|
||||
var result = await new SiteSecretsCollector(store).CollectAsync(
|
||||
@@ -114,6 +124,8 @@ public class SiteSecretsCollectorTests
|
||||
Assert.Contains("InvalidOperationException: db down", result.StoreError);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect caller cancellation still propagates.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_CallerCancellation_StillPropagates()
|
||||
{
|
||||
@@ -125,6 +137,8 @@ public class SiteSecretsCollectorTests
|
||||
[Dc("GW1", """{"ApiKey":"secret:a"}""")], cts.Token));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that collect success has no store error.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Collect_Success_HasNoStoreError()
|
||||
{
|
||||
@@ -144,30 +158,61 @@ public class SiteSecretsCollectorTests
|
||||
{
|
||||
private readonly Dictionary<SecretName, StoredSecret> _rows;
|
||||
|
||||
/// <summary>Initializes a new instance of <c>FakeSecretStore</c>.</summary>
|
||||
/// <param name="rows">The rows.</param>
|
||||
public FakeSecretStore(params StoredSecret[] rows) => _rows = rows.ToDictionary(r => r.Name);
|
||||
|
||||
/// <summary>When set, <see cref="GetAsync"/> throws this instead of reading.</summary>
|
||||
public Exception? Fault { get; init; }
|
||||
|
||||
/// <summary>Returns the canned secret row, or faults when a fault is configured.</summary>
|
||||
/// <param name="name">The secret name to look up.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that yields the stored secret, or null.</returns>
|
||||
public Task<StoredSecret?> GetAsync(SecretName name, CancellationToken ct) =>
|
||||
Fault is not null
|
||||
? Task.FromException<StoredSecret?>(Fault)
|
||||
: Task.FromResult(_rows.TryGetValue(name, out var row) ? row : null);
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="row">The secret row, unused.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task UpsertAsync(StoredSecret row, CancellationToken ct) => throw new NotSupportedException();
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="name">The secret name, unused.</param>
|
||||
/// <param name="actor">The acting user, unused.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that yields whether a row was deleted.</returns>
|
||||
public Task<bool> DeleteAsync(SecretName name, string? actor, CancellationToken ct) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="includeDeleted">Whether tombstoned secrets are included.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that yields the secret metadata.</returns>
|
||||
public Task<IReadOnlyList<SecretMetadata>> ListAsync(bool includeDeleted, CancellationToken ct) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that yields the secret manifest.</returns>
|
||||
public Task<IReadOnlyList<SecretManifestEntry>> GetManifestAsync(CancellationToken ct) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="row">The replicated secret row, unused.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task ApplyReplicatedAsync(StoredSecret row, CancellationToken ct) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
/// <summary>Not supported by this fake.</summary>
|
||||
/// <param name="rewrappedRow">The rewrapped secret row, unused.</param>
|
||||
/// <param name="expectedCurrentWrappedDek">The wrapped data key expected to be current, unused.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <returns>A task that yields whether the rewrap was applied.</returns>
|
||||
public Task<bool> ApplyRewrapAsync(
|
||||
StoredSecret rewrappedRow, byte[] expectedCurrentWrappedDek, CancellationToken ct) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
Reference in New Issue
Block a user