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:
@@ -11,6 +11,7 @@ public class SiteEventLoggerTests : IDisposable
|
||||
private readonly string _dbPath;
|
||||
private readonly TestLocalDb _localDb;
|
||||
|
||||
/// <summary>Initializes the test class with a temporary LocalDb-backed logger.</summary>
|
||||
public SiteEventLoggerTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"test_events_{Guid.NewGuid()}.db");
|
||||
@@ -23,6 +24,7 @@ public class SiteEventLoggerTests : IDisposable
|
||||
_verifyConnection.Open();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by this instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_verifyConnection.Dispose();
|
||||
@@ -31,6 +33,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
TestLocalDb.DeleteFiles(_dbPath);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that logging an event inserts a record.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_InsertsRecord()
|
||||
{
|
||||
@@ -42,6 +46,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.Equal(1, count);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that logging an event stores all of its fields.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_StoresAllFields()
|
||||
{
|
||||
@@ -59,6 +65,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.Equal("{\"value\":95}", reader.GetString(5));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the nullable fields may be left empty.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_NullableFieldsAllowed()
|
||||
{
|
||||
@@ -72,6 +80,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.True(reader.IsDBNull(1));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the stored timestamp is an ISO 8601 UTC value.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_StoresIso8601UtcTimestamp()
|
||||
{
|
||||
@@ -84,6 +94,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.Equal(TimeSpan.Zero, parsed.Offset);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an empty event type throws.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_ThrowsOnEmptyEventType()
|
||||
{
|
||||
@@ -91,6 +103,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
_logger.LogEventAsync("", "Info", null, "Source", "Message"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an empty severity throws.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_ThrowsOnEmptySeverity()
|
||||
{
|
||||
@@ -98,6 +112,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
_logger.LogEventAsync("script", "", null, "Source", "Message"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an empty source throws.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_ThrowsOnEmptySource()
|
||||
{
|
||||
@@ -105,6 +121,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
_logger.LogEventAsync("script", "Info", null, "", "Message"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an empty message throws.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_ThrowsOnEmptyMessage()
|
||||
{
|
||||
@@ -112,6 +130,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
_logger.LogEventAsync("script", "Info", null, "Source", ""));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that multiple events each get a distinct application-minted id.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task LogEventAsync_MultipleEvents_GetDistinctApplicationMintedIds()
|
||||
{
|
||||
@@ -139,6 +159,8 @@ public class SiteEventLoggerTests : IDisposable
|
||||
$"Event id '{id}' is not a GUID in 'N' format."));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that all event types are accepted.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AllEventTypes_Accepted()
|
||||
{
|
||||
@@ -154,8 +176,11 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.Equal(6, count);
|
||||
}
|
||||
|
||||
// --- SiteEventLogging-020: severity validation against the closed set ---
|
||||
// --- Severity validation against the closed set ---
|
||||
|
||||
/// <summary>Verifies that an unknown severity throws.</summary>
|
||||
/// <param name="badSeverity">The bad severity.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Theory]
|
||||
[InlineData("info")] // wrong casing
|
||||
[InlineData("warn")] // abbreviation
|
||||
@@ -170,6 +195,9 @@ public class SiteEventLoggerTests : IDisposable
|
||||
Assert.Contains("Info, Warning, Error", ex.Message);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that every documented severity is accepted.</summary>
|
||||
/// <param name="severity">The severity.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Theory]
|
||||
[InlineData("Info")]
|
||||
[InlineData("Warning")]
|
||||
|
||||
Reference in New Issue
Block a user