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:
@@ -14,9 +14,9 @@ using ZB.MOM.WW.ScadaBridge.ManagementService;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// ManagementActor handler tests for the M9-T32c schema-library CRUD commands. The
|
||||
/// ManagementActor handler tests for the schema-library CRUD commands. The
|
||||
/// reusable named JSON-Schema library (<see cref="SharedSchema"/> +
|
||||
/// <see cref="ISharedSchemaRepository"/>, T32a) gains its authoring surface here:
|
||||
/// <see cref="ISharedSchemaRepository"/>) gains its authoring surface here:
|
||||
/// list/get are read-only (any authenticated user), create/update/delete are
|
||||
/// Designer-gated, the schema JSON is validated as a JSON Schema, and the unique
|
||||
/// Name is enforced with a clear duplicate-name error. Mirrors the repo-backed
|
||||
@@ -28,6 +28,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
private readonly IAuditService _auditService;
|
||||
private readonly ServiceCollection _services;
|
||||
|
||||
/// <summary>Builds the management actor handler over a mocked schema repository.</summary>
|
||||
public SchemaLibraryHandlerTests()
|
||||
{
|
||||
_schemaRepo = Substitute.For<ISharedSchemaRepository>();
|
||||
@@ -49,6 +50,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
new(new AuthenticatedUser("testuser", "Test User", roles, Array.Empty<string>()),
|
||||
command, Guid.NewGuid().ToString("N"));
|
||||
|
||||
/// <inheritdoc />
|
||||
void IDisposable.Dispose() => Shutdown();
|
||||
|
||||
private const string ValidSchema =
|
||||
@@ -56,6 +58,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
|
||||
// ── Gating ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that creating a shared schema with only the Deployer role returns unauthorized.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WithDeployerRole_ReturnsUnauthorized()
|
||||
{
|
||||
@@ -68,6 +71,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("Designer", response.Message);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that updating a shared schema with no roles returns unauthorized.</summary>
|
||||
[Fact]
|
||||
public void UpdateSharedSchema_WithNoRoles_ReturnsUnauthorized()
|
||||
{
|
||||
@@ -80,6 +84,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("Designer", response.Message);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting a shared schema with only the Deployer role returns unauthorized.</summary>
|
||||
[Fact]
|
||||
public void DeleteSharedSchema_WithDeployerRole_ReturnsUnauthorized()
|
||||
{
|
||||
@@ -94,6 +99,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
|
||||
// ── List / Get (read-gated) ─────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that listing shared schemas succeeds for a user with no roles.</summary>
|
||||
[Fact]
|
||||
public void ListSharedSchemas_WithNoRoles_ReturnsSuccess()
|
||||
{
|
||||
@@ -113,6 +119,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("Addr", response.JsonData);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that getting a shared schema succeeds for a user with no roles.</summary>
|
||||
[Fact]
|
||||
public void GetSharedSchema_WithNoRoles_ReturnsSuccess()
|
||||
{
|
||||
@@ -130,6 +137,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
|
||||
// ── Create round-trip + validation ──────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that creating a shared schema with the Designer role persists it and returns the entity.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WithDesignerRole_PersistsAndReturnsEntity()
|
||||
{
|
||||
@@ -155,6 +163,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("42", response.JsonData);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating a shared schema with a duplicate name returns a clear error.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WithDuplicateName_ReturnsClearError()
|
||||
{
|
||||
@@ -173,6 +182,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("already exists", response.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating a shared schema with an empty name returns a clear error.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WithEmptyName_ReturnsClearError()
|
||||
{
|
||||
@@ -187,6 +197,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("name", response.Error, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating a shared schema with invalid JSON returns a clear error.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WithInvalidJson_ReturnsClearError()
|
||||
{
|
||||
@@ -205,6 +216,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
|
||||
// ── Update round-trip + validation ──────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that updating a shared schema with the Designer role persists the changes.</summary>
|
||||
[Fact]
|
||||
public void UpdateSharedSchema_WithDesignerRole_PersistsChanges()
|
||||
{
|
||||
@@ -229,6 +241,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Equal(updatedSchema, existing.SchemaJson);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that updating a shared schema that does not exist returns a clear error.</summary>
|
||||
[Fact]
|
||||
public void UpdateSharedSchema_NotFound_ReturnsClearError()
|
||||
{
|
||||
@@ -246,6 +259,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("99", response.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that renaming a shared schema to an existing name returns a clear error.</summary>
|
||||
[Fact]
|
||||
public void UpdateSharedSchema_RenameToExistingName_ReturnsClearError()
|
||||
{
|
||||
@@ -266,6 +280,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.Contains("already exists", response.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that updating a shared schema while keeping its own name is allowed.</summary>
|
||||
[Fact]
|
||||
public void UpdateSharedSchema_SameName_IsAllowed()
|
||||
{
|
||||
@@ -289,6 +304,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
|
||||
// ── Delete round-trip ───────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that deleting a shared schema with the Designer role deletes it.</summary>
|
||||
[Fact]
|
||||
public void DeleteSharedSchema_WithDesignerRole_Deletes()
|
||||
{
|
||||
@@ -302,10 +318,11 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
_schemaRepo.Received(1).DeleteAsync(5, Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting a shared schema records its human-readable name in the audit entry.</summary>
|
||||
[Fact]
|
||||
public void DeleteSharedSchema_RecordsHumanReadableNameInAudit()
|
||||
{
|
||||
// #260: the delete handler pre-fetches the row name BEFORE deleting so the
|
||||
// The delete handler pre-fetches the row name BEFORE deleting so the
|
||||
// audit EntityName records "Addr" rather than the numeric id (mirroring the
|
||||
// Site delete handler).
|
||||
_schemaRepo.GetByIdAsync(5, Arg.Any<CancellationToken>())
|
||||
@@ -324,6 +341,7 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Arg.Any<object?>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that listing shared schemas returns an error when the repository throws.</summary>
|
||||
[Fact]
|
||||
public void ListSharedSchemas_WhenRepoThrows_ReturnsError()
|
||||
{
|
||||
@@ -340,8 +358,9 @@ public class SchemaLibraryHandlerTests : TestKit, IDisposable
|
||||
Assert.DoesNotContain("db down secret detail", response.Error);
|
||||
}
|
||||
|
||||
// ── Concurrent-create race (#260) ───────────────────────────────────────
|
||||
// ── Concurrent-create race ───────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that a unique-constraint violation from a racing insert surfaces as a sanitized error.</summary>
|
||||
[Fact]
|
||||
public void CreateSharedSchema_WhenInsertRacesUniqueViolation_SurfacesSanitizedError()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user