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 sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
private ApiKeyOptions _options = null!;
|
||||
private IInboundApiKeyAdmin _sut = null!;
|
||||
|
||||
/// <summary>Creates the temporary store, migrates it and builds the admin services.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
_factory = new AuthSqliteConnectionFactory(_dbPath);
|
||||
@@ -54,6 +56,9 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
_sut = new LibraryInboundApiKeyAdmin(commands);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that CreateAsync throws for a null or whitespace name.</summary>
|
||||
/// <param name="name">The key name under test.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
@@ -66,6 +71,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
() => _sut.CreateAsync(name!, new[] { "MethodA" }, CancellationToken.None));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that CreateAsync returns a key id and a token that starts with the sbk prefix.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreateAsync_ReturnsKeyIdAndToken_TokenStartsWith_sbk()
|
||||
{
|
||||
@@ -83,6 +90,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
Assert.Equal(new[] { "MethodA", "MethodB" }, info.Methods);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that disabling then enabling a key toggles the listed enabled flag.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetEnabledAsync_False_ThenTrue_Toggles_ListedEnabledFlag()
|
||||
{
|
||||
@@ -98,12 +107,16 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
Assert.True((await SingleAsync(created.KeyId)).Enabled);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that SetEnabledAsync returns false for an unknown key.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetEnabledAsync_UnknownKey_ReturnsFalse()
|
||||
{
|
||||
Assert.False(await _sut.SetEnabledAsync("does-not-exist", enabled: false, CancellationToken.None));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that SetMethodsAsync replaces the key's methods.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SetMethodsAsync_ReplacesMethods()
|
||||
{
|
||||
@@ -129,6 +142,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
Assert.DoesNotContain(created.KeyId, outOfScope);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that DeleteAsync removes the key.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeleteAsync_RemovesKey()
|
||||
{
|
||||
@@ -148,6 +163,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
k => k.KeyId == created.KeyId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that GetKeysForMethodAsync returns only the keys scoped to that method.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetKeysForMethodAsync_ReturnsOnlyKeysScopedToThatMethod()
|
||||
{
|
||||
@@ -171,6 +188,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
Assert.Empty(await _sut.GetKeysForMethodAsync("Nobody", CancellationToken.None));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that GetMethodsForKeyAsync returns an empty result for an unknown key.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetMethodsForKeyAsync_UnknownKey_ReturnsEmpty()
|
||||
{
|
||||
@@ -183,6 +202,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
return Assert.Single(keys, k => k.KeyId == keyId);
|
||||
}
|
||||
|
||||
/// <summary>Clears SQLite connection pools and deletes the temporary database files.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task DisposeAsync()
|
||||
{
|
||||
// SqliteConnection pooling can hold the file open; clear pools before deleting
|
||||
@@ -202,6 +223,8 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
|
||||
private sealed class FakePepperProvider(string? pepper) : IApiKeyPepperProvider
|
||||
{
|
||||
/// <summary>Returns the fixed pepper.</summary>
|
||||
/// <returns>The configured pepper value.</returns>
|
||||
public string? GetPepper() => pepper;
|
||||
}
|
||||
|
||||
@@ -209,6 +232,7 @@ public sealed class LibraryInboundApiKeyAdminTests : IAsyncLifetime
|
||||
{
|
||||
private readonly DateTimeOffset _now = now;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override DateTimeOffset GetUtcNow() => _now;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user