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,6 +17,9 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
private readonly IReadOnlyList<LdapGroupMapping> _mappings;
|
||||
private readonly IReadOnlyDictionary<int, IReadOnlyList<SiteScopeRule>> _scopeRules;
|
||||
|
||||
/// <summary>Initializes the fake repository with fixed mappings and scope rules.</summary>
|
||||
/// <param name="mappings">The LDAP group mappings to return.</param>
|
||||
/// <param name="scopeRules">The site scope rules keyed by LDAP group mapping id.</param>
|
||||
public FakeSecurityRepository(
|
||||
IReadOnlyList<LdapGroupMapping> mappings,
|
||||
IReadOnlyDictionary<int, IReadOnlyList<SiteScopeRule>> scopeRules)
|
||||
@@ -25,32 +28,44 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
_scopeRules = scopeRules;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<LdapGroupMapping>> GetAllMappingsAsync(CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(_mappings);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<SiteScopeRule>> GetScopeRulesForMappingAsync(int ldapGroupMappingId, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(_scopeRules.TryGetValue(ldapGroupMappingId, out var rules)
|
||||
? rules
|
||||
: (IReadOnlyList<SiteScopeRule>)Array.Empty<SiteScopeRule>());
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<LdapGroupMapping?> GetMappingByIdAsync(int id, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<LdapGroupMapping>> GetMappingsByRoleAsync(string role, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task AddMappingAsync(LdapGroupMapping mapping, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task UpdateMappingAsync(LdapGroupMapping mapping, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task DeleteMappingAsync(int id, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task<SiteScopeRule?> GetScopeRuleByIdAsync(int id, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task AddScopeRuleAsync(SiteScopeRule rule, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task UpdateScopeRuleAsync(SiteScopeRule rule, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task DeleteScopeRuleAsync(int id, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
/// <inheritdoc />
|
||||
public Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
@@ -62,6 +77,8 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
return m;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that mapping returns the same roles as the role mapper and carries the result in a site-scoped scope.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MapAsync_ReturnsSameRolesAsRoleMapper_AndCarriesResultInScope_SiteScoped()
|
||||
{
|
||||
@@ -103,6 +120,8 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
Assert.Equal(expected.IsSystemWideDeployment, scope.IsSystemWideDeployment);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that mapping preserves the system-wide deployment flag in the scope.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MapAsync_PreservesSystemWideDeploymentFlagInScope()
|
||||
{
|
||||
@@ -123,10 +142,12 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
Assert.Empty(scope.PermittedSiteIds);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that mapping empty groups returns no roles and a non-null scope.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MapAsync_EmptyGroups_ReturnsNoRoles_AndNonNullScope()
|
||||
{
|
||||
// Reviewer-requested empty-groups case (Task 1.2): a user that resolves to NO
|
||||
// Empty-groups case: a user that resolves to NO
|
||||
// groups must map to NO roles and a non-null, not-system-wide Scope with no
|
||||
// permitted sites — so the login endpoint can build a roleless principal (which
|
||||
// every authorization policy then denies) without NRE-ing on Scope. This is the
|
||||
@@ -147,6 +168,8 @@ public class ScadaBridgeGroupRoleMapperTests
|
||||
Assert.Empty(scope.PermittedSiteIds);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that mapping groups that match no mapping returns no roles.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MapAsync_GroupsMatchNoMapping_ReturnsNoRoles()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user