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:
@@ -12,11 +12,14 @@ public class AreaServiceTests
|
||||
private readonly Mock<IAuditService> _auditMock = new();
|
||||
private readonly AreaService _sut;
|
||||
|
||||
/// <summary>Initializes the test class with a mocked repository and the service under test.</summary>
|
||||
public AreaServiceTests()
|
||||
{
|
||||
_sut = new AreaService(_repoMock.Object, _auditMock.Object);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating an area with valid input succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreateArea_ValidInput_ReturnsSuccess()
|
||||
{
|
||||
@@ -32,6 +35,8 @@ public class AreaServiceTests
|
||||
Assert.Equal(1, result.Value.SiteId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating an area with a duplicate name fails.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreateArea_DuplicateName_ReturnsFailure()
|
||||
{
|
||||
@@ -47,6 +52,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("already exists", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating an area with a parent validates that the parent belongs to the site.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreateArea_WithParent_ValidatesParentBelongsToSite()
|
||||
{
|
||||
@@ -59,6 +66,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("does not belong", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting an area with assigned instances fails.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeleteArea_WithAssignedInstances_ReturnsFailure()
|
||||
{
|
||||
@@ -78,6 +87,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("instance(s) are assigned", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting an area with child areas fails.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeleteArea_WithChildAreas_ReturnsFailure()
|
||||
{
|
||||
@@ -98,6 +109,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("child areas", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting an unconstrained area succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeleteArea_NoConstraints_Success()
|
||||
{
|
||||
@@ -116,6 +129,8 @@ public class AreaServiceTests
|
||||
_repoMock.Verify(r => r.DeleteAreaAsync(1, It.IsAny<CancellationToken>()), Times.Once);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area under another area succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_ToOtherArea_Succeeds()
|
||||
{
|
||||
@@ -141,6 +156,8 @@ public class AreaServiceTests
|
||||
_auditMock.Verify(a => a.LogAsync("admin", "Move", "Area", "3", "Leaf", It.IsAny<object>(), It.IsAny<CancellationToken>()), Times.Once);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area to the site root succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_ToSiteRoot_Succeeds()
|
||||
{
|
||||
@@ -161,6 +178,8 @@ public class AreaServiceTests
|
||||
Assert.Null(result.Value.ParentAreaId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area under itself fails.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_ToSelf_Fails()
|
||||
{
|
||||
@@ -173,6 +192,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("its own parent", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area under one of its descendants fails with a cycle error.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_ToDescendant_FailsWithCycleError()
|
||||
{
|
||||
@@ -195,6 +216,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("descendants", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area to a different site fails.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_DifferentSite_Fails()
|
||||
{
|
||||
@@ -209,6 +232,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("same site", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area fails when its name collides at the new parent.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_NameCollidesAtNewParent_Fails()
|
||||
{
|
||||
@@ -232,6 +257,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("already exists", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area to its current parent succeeds as a no-op.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_SameParent_NoOpSuccess()
|
||||
{
|
||||
@@ -253,6 +280,8 @@ public class AreaServiceTests
|
||||
_auditMock.Verify(a => a.LogAsync(It.IsAny<string>(), "Move", It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<CancellationToken>()), Times.Never);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that moving an area fails when the target parent does not exist.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MoveArea_TargetParentMissing_Fails()
|
||||
{
|
||||
@@ -267,6 +296,8 @@ public class AreaServiceTests
|
||||
Assert.Contains("not found", result.Error);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deleting an area is blocked when its descendants have assigned instances.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeleteArea_InstancesInDescendants_Blocked()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user