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:
@@ -13,7 +13,7 @@ using ApiKeyForm = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Admin.ApiKey
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Admin;
|
||||
|
||||
/// <summary>
|
||||
/// Bundle D drill-in test (#23 M7-T12) for the API Keys edit page, re-wired for the
|
||||
/// Drill-in test for the API Keys edit page, re-wired for the
|
||||
/// inbound-API-key re-arch (C3) onto the <see cref="IInboundApiKeyAdmin"/> seam. The chip
|
||||
/// routes operators into the central Audit Log pre-filtered by Actor = key Name AND
|
||||
/// Channel = ApiInbound (no other channel uses the key name as actor, but the explicit
|
||||
@@ -25,6 +25,7 @@ public class ApiKeyFormAuditDrillinTests : BunitContext
|
||||
private readonly IInboundApiKeyAdmin _admin = Substitute.For<IInboundApiKeyAdmin>();
|
||||
private readonly IInboundApiRepository _repo = Substitute.For<IInboundApiRepository>();
|
||||
|
||||
/// <summary>Creates the test class and registers the stubbed services the page needs.</summary>
|
||||
public ApiKeyFormAuditDrillinTests()
|
||||
{
|
||||
Services.AddSingleton(_admin);
|
||||
@@ -50,6 +51,7 @@ public class ApiKeyFormAuditDrillinTests : BunitContext
|
||||
string keyId, string name, bool enabled = true, params string[] methods) =>
|
||||
new(keyId, name, enabled, methods, DateTimeOffset.UnixEpoch, null);
|
||||
|
||||
/// <summary>Verifies that the edit page has a recent audit activity link filtered by actor and the inbound API channel.</summary>
|
||||
[Fact]
|
||||
public void EditPage_HasRecentAuditActivityLink_WithActorAndApiInboundChannel()
|
||||
{
|
||||
@@ -72,6 +74,7 @@ public class ApiKeyFormAuditDrillinTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the create page has no recent audit activity link.</summary>
|
||||
[Fact]
|
||||
public void CreatePage_HasNoRecentAuditActivityLink()
|
||||
{
|
||||
@@ -86,6 +89,8 @@ public class ApiKeyFormAuditDrillinTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating a key with a method selected shows the one-time token and key id.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreatePage_WithMethodSelected_ShowsOneTimeTokenAndKeyId()
|
||||
{
|
||||
@@ -118,6 +123,8 @@ public class ApiKeyFormAuditDrillinTests : BunitContext
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that creating a key with no method selected shows a validation error and creates nothing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CreatePage_WithNoMethodSelected_ShowsValidationError_AndDoesNotCreate()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ public class ApiKeysListPageTests : BunitContext
|
||||
{
|
||||
private readonly IInboundApiKeyAdmin _admin = Substitute.For<IInboundApiKeyAdmin>();
|
||||
|
||||
/// <summary>Initializes the test context and registers the fake API key seam.</summary>
|
||||
public ApiKeysListPageTests()
|
||||
{
|
||||
Services.AddSingleton(_admin);
|
||||
@@ -40,6 +41,7 @@ public class ApiKeysListPageTests : BunitContext
|
||||
string keyId, string name, bool enabled, params string[] methods) =>
|
||||
new(keyId, name, enabled, methods, DateTimeOffset.UnixEpoch, null);
|
||||
|
||||
/// <summary>Verifies that the list renders the keys from the seam and shows no key hash column.</summary>
|
||||
[Fact]
|
||||
public void List_RendersKeysFromSeam_WithNoKeyHashColumn()
|
||||
{
|
||||
@@ -76,6 +78,8 @@ public class ApiKeysListPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that toggling a key calls SetEnabled on the seam.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ToggleKey_CallsSetEnabledOnSeam()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ using SiteForm = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Admin.SiteForm
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Admin;
|
||||
|
||||
/// <summary>
|
||||
/// Bundle D drill-in test (#23 M7-T12) for the Site edit page. The chip
|
||||
/// Drill-in test for the Site edit page. The chip
|
||||
/// routes operators into the central Audit Log pre-filtered by SourceSiteId =
|
||||
/// Site.SiteIdentifier (the same string the audit pipeline stamps onto every
|
||||
/// site-sourced row). Create mode suppresses the link — there's no site yet.
|
||||
@@ -25,6 +25,7 @@ public class SiteFormAuditDrillinTests : BunitContext
|
||||
private readonly ISiteRepository _siteRepo = Substitute.For<ISiteRepository>();
|
||||
private readonly CommunicationService _comms;
|
||||
|
||||
/// <summary>Initializes the test context with a stubbed site repository, communication service and an administrator identity.</summary>
|
||||
public SiteFormAuditDrillinTests()
|
||||
{
|
||||
_comms = new CommunicationService(
|
||||
@@ -45,6 +46,7 @@ public class SiteFormAuditDrillinTests : BunitContext
|
||||
AuthorizationPolicies.AddScadaBridgeAuthorization(Services);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the edit page links to recent audit activity filtered by the site identifier.</summary>
|
||||
[Fact]
|
||||
public void EditPage_HasRecentAuditActivityLink_WithSiteEqualToSiteIdentifier()
|
||||
{
|
||||
@@ -61,6 +63,7 @@ public class SiteFormAuditDrillinTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the create page shows no recent audit activity link.</summary>
|
||||
[Fact]
|
||||
public void CreatePage_HasNoRecentAuditActivityLink()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ using SitesPage = ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Admin.Sites;
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Admin;
|
||||
|
||||
/// <summary>
|
||||
/// Regression tests for CentralUI-012. The Sites page loaded all sites and then
|
||||
/// Regression tests for the Sites page N+1 query fix. The Sites page loaded all sites and then
|
||||
/// issued <c>GetDataConnectionsBySiteIdAsync</c> once per site (N+1 database
|
||||
/// round-trips on every load and post-delete refresh). The fix fetches all
|
||||
/// data connections in a single <c>GetAllDataConnectionsAsync</c> call and
|
||||
@@ -73,7 +73,10 @@ public class SitesPageTests : BunitContext
|
||||
private sealed class StubAuthStateProvider : AuthenticationStateProvider
|
||||
{
|
||||
private readonly AuthenticationState _state;
|
||||
/// <summary>Initializes a new instance of the <see cref="StubAuthStateProvider"/> class.</summary>
|
||||
/// <param name="state">The authentication state returned to callers.</param>
|
||||
public StubAuthStateProvider(AuthenticationState state) => _state = state;
|
||||
/// <inheritdoc />
|
||||
public override Task<AuthenticationState> GetAuthenticationStateAsync()
|
||||
=> Task.FromResult(_state);
|
||||
}
|
||||
@@ -105,6 +108,7 @@ public class SitesPageTests : BunitContext
|
||||
stale,
|
||||
unknown);
|
||||
|
||||
/// <summary>Verifies that loading data fetches all connections in one query rather than one query per site.</summary>
|
||||
[Fact]
|
||||
public void LoadData_FetchesAllConnectionsInOneQuery_NoPerSiteQueries()
|
||||
{
|
||||
@@ -122,6 +126,7 @@ public class SitesPageTests : BunitContext
|
||||
_siteRepo.DidNotReceive().GetDataConnectionsBySiteIdAsync(Arg.Any<int>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that loading data groups connections by site and renders them under their site.</summary>
|
||||
[Fact]
|
||||
public void LoadData_GroupsConnectionsBySite_AndRendersThem()
|
||||
{
|
||||
@@ -138,6 +143,7 @@ public class SitesPageTests : BunitContext
|
||||
Assert.Contains("beta-conn", cut.Markup);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the artifact badge shows Current, Out of date or Never deployed according to the site's artifact state.</summary>
|
||||
[Fact]
|
||||
public void ArtifactBadge_ShowsCurrent_OutOfDate_NeverDeployed()
|
||||
{
|
||||
@@ -163,6 +169,7 @@ public class SitesPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the instance line shows the stale count out of the deployed count.</summary>
|
||||
[Fact]
|
||||
public void InstanceLine_ShowsStaleOfDeployed()
|
||||
{
|
||||
@@ -183,6 +190,7 @@ public class SitesPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the instance line uses the correct singular wording when exactly one instance is affected.</summary>
|
||||
[Fact]
|
||||
public void InstanceLine_PluralisesTheSingleInstanceCase()
|
||||
{
|
||||
@@ -204,6 +212,7 @@ public class SitesPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that Re-check forces a refresh of the pending-updates snapshot.</summary>
|
||||
[Fact]
|
||||
public void Recheck_ForcesRefresh()
|
||||
{
|
||||
@@ -218,6 +227,7 @@ public class SitesPageTests : BunitContext
|
||||
_pendingUpdates.Received().GetAsync(true, Arg.Any<CancellationToken>()));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a failure loading sites skips the fleet-wide evaluation.</summary>
|
||||
[Fact]
|
||||
public void SiteLoadFailure_SkipsTheFleetEvaluation()
|
||||
{
|
||||
@@ -232,6 +242,7 @@ public class SitesPageTests : BunitContext
|
||||
_pendingUpdates.DidNotReceive().GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a failed re-check clears the stale as-of caption.</summary>
|
||||
[Fact]
|
||||
public void FailedRecheck_ClearsTheStaleAsOfCaption()
|
||||
{
|
||||
@@ -258,6 +269,7 @@ public class SitesPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a cache fault shows an unavailable state while the sites still render.</summary>
|
||||
[Fact]
|
||||
public void CacheFault_ShowsUnavailable_AndSitesStillRender()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user