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:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -17,6 +17,7 @@ public class SecurityRepositoryTests : IDisposable
private readonly ScadaBridgeDbContext _context;
private readonly SecurityRepository _repository;
/// <summary>Initializes the test class with a fresh in-memory database context.</summary>
public SecurityRepositoryTests()
{
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
@@ -29,12 +30,15 @@ public class SecurityRepositoryTests : IDisposable
_repository = new SecurityRepository(_context);
}
/// <summary>Releases the resources held by this instance.</summary>
public void Dispose()
{
_context.Database.CloseConnection();
_context.Dispose();
}
/// <summary>Verifies that an added mapping can be retrieved by its id.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task AddMapping_AndGetById_ReturnsMapping()
{
@@ -48,6 +52,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Equal("Administrator", loaded.Role);
}
/// <summary>Verifies that getting all mappings returns every mapping.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAllMappings_ReturnsAll()
{
@@ -60,6 +66,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.True(all.Count >= 2);
}
/// <summary>Verifies that getting mappings by role returns only the matching mappings.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetMappingsByRole_FiltersCorrectly()
{
@@ -73,6 +81,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Contains(designMappings, m => m.LdapGroupName == "Designers");
}
/// <summary>Verifies that updating a mapping persists the change.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task UpdateMapping_PersistsChange()
{
@@ -89,6 +99,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Equal("Designer", loaded!.Role);
}
/// <summary>Verifies that deleting a mapping removes the entity.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteMapping_RemovesEntity()
{
@@ -103,6 +115,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Null(loaded);
}
/// <summary>Verifies that an added scope rule can be retrieved for its mapping.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task AddScopeRule_AndGetForMapping()
{
@@ -121,6 +135,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Equal(site.Id, rules[0].SiteId);
}
/// <summary>Verifies that getting a scope rule by id returns the rule.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetScopeRuleById_ReturnsRule()
{
@@ -139,6 +155,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Equal(mapping.Id, loaded.LdapGroupMappingId);
}
/// <summary>Verifies that updating a scope rule persists the change.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task UpdateScopeRule_PersistsChange()
{
@@ -162,6 +180,8 @@ public class SecurityRepositoryTests : IDisposable
Assert.Equal(site2.Id, loaded!.SiteId);
}
/// <summary>Verifies that deleting a scope rule removes the entity.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeleteScopeRule_RemovesEntity()
{
@@ -188,18 +208,22 @@ public class CentralUiRepositoryTests : IDisposable
private readonly ScadaBridgeDbContext _context;
private readonly CentralUiRepository _repository;
/// <summary>Initializes the test class with a fresh in-memory database context.</summary>
public CentralUiRepositoryTests()
{
_context = SqliteTestHelper.CreateInMemoryContext();
_repository = new CentralUiRepository(_context);
}
/// <summary>Releases the resources held by this instance.</summary>
public void Dispose()
{
_context.Database.CloseConnection();
_context.Dispose();
}
/// <summary>Verifies that getting all sites returns them ordered by name.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAllSites_ReturnsOrderedByName()
{
@@ -214,6 +238,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal("Zulu", sites[1].Name);
}
/// <summary>Verifies that filtered instances can be restricted by site id.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetInstancesFiltered_BySiteId()
{
@@ -234,6 +260,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal("Inst1", instances[0].UniqueName);
}
/// <summary>Verifies that filtered instances can be restricted by search term.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetInstancesFiltered_BySearchTerm()
{
@@ -252,6 +280,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(instances);
}
/// <summary>Verifies that recent deployments are returned in reverse chronological order.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetRecentDeployments_ReturnsInReverseChronological()
{
@@ -277,6 +307,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal("d-002", recent[1].DeploymentId);
}
/// <summary>Verifies that audit log entries can be filtered by user.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByUser()
{
@@ -291,6 +323,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal("admin", entries[0].User);
}
/// <summary>Verifies that audit log entries can be filtered by entity type.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByEntityType()
{
@@ -304,6 +338,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal(1, total);
}
/// <summary>Verifies that audit log entries can be filtered by action type.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByActionType()
{
@@ -316,6 +352,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(entries);
}
/// <summary>Verifies that audit log entries can be filtered by time range.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByTimeRange()
{
@@ -329,6 +367,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(entries);
}
/// <summary>Verifies that audit log entries can be filtered by entity id.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByEntityId()
{
@@ -341,6 +381,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(entries);
}
/// <summary>Verifies that audit log entries can be filtered by entity name.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByEntityName()
{
@@ -353,6 +395,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(entries);
}
/// <summary>Verifies that audit log entries can be filtered by bundle import id.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_FiltersByBundleImportId()
{
@@ -376,6 +420,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal(importA, entries[0].BundleImportId);
}
/// <summary>Verifies that audit log entries are returned in reverse chronological order with pagination.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAuditLogEntries_ReverseChronologicalWithPagination()
{
@@ -399,6 +445,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Equal("T6", page2[0].EntityName);
}
/// <summary>Verifies that the template tree includes child entities.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetTemplateTree_IncludesChildren()
{
@@ -413,6 +461,8 @@ public class CentralUiRepositoryTests : IDisposable
Assert.Single(loaded.Attributes);
}
/// <summary>Verifies that the area tree returns the area hierarchy.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAreaTree_ReturnsHierarchy()
{