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:
@@ -17,12 +17,14 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
{
|
||||
private readonly string _dir;
|
||||
|
||||
/// <summary>Initializes the tests with a fresh temporary directory.</summary>
|
||||
public InboundApiKeyStoreImportServiceTests()
|
||||
{
|
||||
_dir = Path.Combine(Path.GetTempPath(), $"sb_apikey_import_{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(_dir);
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by the test fixture.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
@@ -35,6 +37,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a present file is imported and then renamed along with its sidecar files.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_FilePresent_ImportsThenRenamesFileAndSidecars()
|
||||
{
|
||||
@@ -56,6 +60,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.True(File.Exists(path + "-shm.imported"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the importer is not called when the file is absent.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_FileAbsent_DoesNotCallImporter()
|
||||
{
|
||||
@@ -67,6 +73,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.Empty(importer.Calls);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the importer is not called when the configured path is blank.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_BlankPath_DoesNotCallImporter()
|
||||
{
|
||||
@@ -78,6 +86,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.Empty(importer.Calls);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the import-from path overrides the path in the API key options.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_ImportFromSqlitePath_OverridesApiKeyOptionsPath()
|
||||
{
|
||||
@@ -94,6 +104,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.True(File.Exists(overridePath + ".imported"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an importer failure does not throw and leaves the file in place.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_ImporterThrows_DoesNotThrowAndLeavesFileInPlace()
|
||||
{
|
||||
@@ -109,6 +121,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.False(File.Exists(path + ".imported"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a primary key violation is retried once and then succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_PrimaryKeyViolation_RetriesOnceThenSucceeds()
|
||||
{
|
||||
@@ -126,6 +140,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.True(File.Exists(path + ".imported"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that two consecutive primary key violations do not throw and leave the file in place.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_PrimaryKeyViolationTwice_DoesNotThrowAndLeavesFileInPlace()
|
||||
{
|
||||
@@ -143,6 +159,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.True(File.Exists(path));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a SQL exception other than a primary key violation is not retried.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_NonPrimaryKeySqlException_DoesNotRetry()
|
||||
{
|
||||
@@ -160,6 +178,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.True(File.Exists(path));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a stale previously imported file is overwritten by the rename.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_StaleImportedFilePresent_IsOverwritten()
|
||||
{
|
||||
@@ -175,6 +195,8 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
Assert.Equal("fresh", File.ReadAllText(path + ".imported"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that stopping the service does nothing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StopAsync_IsANoOp()
|
||||
{
|
||||
@@ -211,11 +233,13 @@ public sealed class InboundApiKeyStoreImportServiceTests : IDisposable
|
||||
{
|
||||
private int _calls;
|
||||
|
||||
/// <summary>Gets the SQLite paths the importer was called with, in call order.</summary>
|
||||
public List<string> Calls { get; } = new();
|
||||
|
||||
/// <summary>Given the 1-based call number, returns the exception to throw, or null to succeed.</summary>
|
||||
public Func<int, Exception?>? ThrowOnCall { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<ApiKeyImportResult> ImportAsync(string sqlitePath, CancellationToken ct)
|
||||
{
|
||||
Calls.Add(sqlitePath);
|
||||
|
||||
Reference in New Issue
Block a user