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:
@@ -18,11 +18,11 @@ using ZB.MOM.WW.ScadaBridge.Security.Auth;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for <see cref="DebugStreamHub"/> per-instance site-scope authorization
|
||||
/// (finding ManagementService-003).
|
||||
/// Tests for <see cref="DebugStreamHub"/> per-instance site-scope authorization.
|
||||
/// </summary>
|
||||
public class DebugStreamHubTests
|
||||
{
|
||||
/// <summary>Verifies that a site-scoped user is allowed to access an instance within their site scope.</summary>
|
||||
[Fact]
|
||||
public void IsInstanceAccessAllowed_SiteScopedUser_InScopeInstance_Allowed()
|
||||
{
|
||||
@@ -34,6 +34,7 @@ public class DebugStreamHubTests
|
||||
Assert.True(allowed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a site-scoped user is denied access to an instance outside their site scope.</summary>
|
||||
[Fact]
|
||||
public void IsInstanceAccessAllowed_SiteScopedUser_OutOfScopeInstance_Denied()
|
||||
{
|
||||
@@ -45,6 +46,7 @@ public class DebugStreamHubTests
|
||||
Assert.False(allowed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a system-wide deployment user is allowed to access instances at any site.</summary>
|
||||
[Fact]
|
||||
public void IsInstanceAccessAllowed_SystemWideDeployment_AnySiteAllowed()
|
||||
{
|
||||
@@ -57,6 +59,7 @@ public class DebugStreamHubTests
|
||||
Assert.True(allowed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the Administrator role bypasses site scoping.</summary>
|
||||
[Fact]
|
||||
public void IsInstanceAccessAllowed_AdminRole_BypassesSiteScope()
|
||||
{
|
||||
@@ -68,6 +71,7 @@ public class DebugStreamHubTests
|
||||
Assert.True(allowed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the Administrator role check is case-insensitive.</summary>
|
||||
[Fact]
|
||||
public void IsInstanceAccessAllowed_AdminRoleCheck_IsCaseInsensitive()
|
||||
{
|
||||
@@ -85,6 +89,7 @@ public class DebugStreamHubTests
|
||||
private readonly ServiceProvider _provider;
|
||||
private readonly LoginThrottle _throttle;
|
||||
|
||||
/// <summary>Initializes the test with a substituted LDAP service, a login throttle and a service provider.</summary>
|
||||
public DebugStreamHubTests()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
@@ -120,6 +125,8 @@ public class DebugStreamHubTests
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that failed binds on connect feed the shared login throttle.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task OnConnectedAsync_FailedBinds_FeedTheSharedLoginThrottle()
|
||||
{
|
||||
@@ -131,6 +138,8 @@ public class DebugStreamHubTests
|
||||
Assert.True(_throttle.IsLockedOut("alice", "10.0.0.1"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a locked-out key aborts the connection without contacting LDAP.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task OnConnectedAsync_LockedOutKey_AbortsWithoutContactingLdap()
|
||||
{
|
||||
@@ -144,17 +153,31 @@ public class DebugStreamHubTests
|
||||
private sealed class TestHubCallerContext : HubCallerContext
|
||||
{
|
||||
private readonly FeatureCollection _features = new();
|
||||
/// <summary>Initializes the context so that its HTTP context feature returns the given request context.</summary>
|
||||
/// <param name="http">The HTTP context exposed through the context feature.</param>
|
||||
public TestHubCallerContext(HttpContext http) =>
|
||||
_features.Set<IHttpContextFeature>(new TestHttpContextFeature { HttpContext = http });
|
||||
/// <summary>Gets a value indicating whether <see cref="Abort"/> has been called.</summary>
|
||||
public bool Aborted { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public override string ConnectionId => "test-conn";
|
||||
/// <inheritdoc />
|
||||
public override string? UserIdentifier => null;
|
||||
/// <inheritdoc />
|
||||
public override System.Security.Claims.ClaimsPrincipal? User => null;
|
||||
/// <inheritdoc />
|
||||
public override IDictionary<object, object?> Items { get; } = new Dictionary<object, object?>();
|
||||
/// <inheritdoc />
|
||||
public override IFeatureCollection Features => _features;
|
||||
/// <inheritdoc />
|
||||
public override CancellationToken ConnectionAborted => CancellationToken.None;
|
||||
/// <inheritdoc />
|
||||
public override void Abort() => Aborted = true;
|
||||
|
||||
private sealed class TestHttpContextFeature : IHttpContextFeature { public HttpContext? HttpContext { get; set; } }
|
||||
private sealed class TestHttpContextFeature : IHttpContextFeature
|
||||
{
|
||||
/// <summary>Gets or sets the HTTP context exposed by the feature.</summary>
|
||||
public HttpContext? HttpContext { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user