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:
@@ -19,17 +19,20 @@ public class DbContextTests : IDisposable
|
||||
{
|
||||
private readonly ScadaBridgeDbContext _context;
|
||||
|
||||
/// <summary>Creates the test class with a fresh in-memory database context.</summary>
|
||||
public DbContextTests()
|
||||
{
|
||||
_context = SqliteTestHelper.CreateInMemoryContext();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by the test fixture.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Database.CloseConnection();
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the schema creates all expected tables.</summary>
|
||||
[Fact]
|
||||
public void Schema_CreatesAllTables()
|
||||
{
|
||||
@@ -69,6 +72,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Empty(_context.AuditLogEntries.ToList());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a template and its child entities are created together.</summary>
|
||||
[Fact]
|
||||
public void Template_WithChildren_CascadeCreated()
|
||||
{
|
||||
@@ -95,6 +99,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal("Attr1", loaded.Attributes.First().Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a template can reference a parent template through inheritance.</summary>
|
||||
[Fact]
|
||||
public void Template_Inheritance_SelfReference()
|
||||
{
|
||||
@@ -110,6 +115,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(parent.Id, loaded.ParentTemplateId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a template composition creates the relationship between templates.</summary>
|
||||
[Fact]
|
||||
public void Template_Composition_CreatesRelationship()
|
||||
{
|
||||
@@ -129,6 +135,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(composedTemplate.Id, loaded.Compositions.First().ComposedTemplateId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an instance persists its overrides and connection bindings.</summary>
|
||||
[Fact]
|
||||
public void Instance_WithOverridesAndBindings()
|
||||
{
|
||||
@@ -163,6 +170,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(InstanceState.Enabled, loaded.State);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a deployment record persists with all its fields.</summary>
|
||||
[Fact]
|
||||
public void DeploymentRecord_CreatesWithAllFields()
|
||||
{
|
||||
@@ -192,6 +200,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal("abc123", loaded.RevisionHash);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an audit log entry can be written and queried.</summary>
|
||||
[Fact]
|
||||
public void AuditLogEntry_WritesAndQueries()
|
||||
{
|
||||
@@ -209,6 +218,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.NotNull(loaded.AfterStateJson);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an external system persists with its methods.</summary>
|
||||
[Fact]
|
||||
public void ExternalSystem_WithMethods()
|
||||
{
|
||||
@@ -230,6 +240,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Single(_context.ExternalSystemMethods.Where(m => m.ExternalSystemDefinitionId == system.Id));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a notification list persists with its recipients.</summary>
|
||||
[Fact]
|
||||
public void NotificationList_WithRecipients()
|
||||
{
|
||||
@@ -247,6 +258,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(2, loaded.Recipients.Count);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an LDAP group mapping persists with its site scope rules.</summary>
|
||||
[Fact]
|
||||
public void Security_LdapGroupMapping_WithSiteScopeRules()
|
||||
{
|
||||
@@ -265,6 +277,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Single(_context.SiteScopeRules.Where(r => r.LdapGroupMappingId == mapping.Id));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an inbound API method persists.</summary>
|
||||
[Fact]
|
||||
public void InboundApi_Method()
|
||||
{
|
||||
@@ -279,6 +292,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Single(_context.ApiMethods.Where(m => m.Name == "GetStatus"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that areas form a parent-child hierarchy.</summary>
|
||||
[Fact]
|
||||
public void Area_HierarchyWorks()
|
||||
{
|
||||
@@ -302,6 +316,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal("Floor 1", loaded.Children.First().Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a data connection belongs to its site.</summary>
|
||||
[Fact]
|
||||
public void DataConnection_BelongsToSite()
|
||||
{
|
||||
@@ -317,6 +332,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(site.Id, loaded.SiteId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that enum properties are stored as strings.</summary>
|
||||
[Fact]
|
||||
public void EnumProperties_StoredAsStrings()
|
||||
{
|
||||
@@ -334,6 +350,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.Equal(AlarmTriggerType.RangeViolation, alarm.TriggerType);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the unique constraint on template names is enforced.</summary>
|
||||
[Fact]
|
||||
public void UniqueConstraint_Template_Name_Enforced()
|
||||
{
|
||||
@@ -344,6 +361,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.ThrowsAny<Exception>(() => _context.SaveChanges());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that date-time offset values are mapped correctly.</summary>
|
||||
[Fact]
|
||||
public void DateTimeOffset_MappedCorrectly()
|
||||
{
|
||||
@@ -361,6 +379,7 @@ public class DbContextTests : IDisposable
|
||||
|
||||
public class ServiceRegistrationTests
|
||||
{
|
||||
/// <summary>Verifies that registering the configuration database with a connection string registers the database context.</summary>
|
||||
[Fact]
|
||||
public void AddConfigurationDatabase_WithConnectionString_RegistersDbContext()
|
||||
{
|
||||
@@ -373,10 +392,11 @@ public class ServiceRegistrationTests
|
||||
Assert.NotNull(context);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the no-argument registration overload fails fast.</summary>
|
||||
[Fact]
|
||||
public void AddConfigurationDatabase_NoArgs_FailsFast()
|
||||
{
|
||||
// ConfigurationDatabase-003: the no-arg overload previously silently registered
|
||||
// The no-arg overload previously silently registered
|
||||
// nothing, which deferred a misconfiguration into an opaque DI failure later.
|
||||
// It is now [Obsolete(error: true)] (compile-time guard) and throws at runtime.
|
||||
// Invoked via reflection because the obsolete-error overload cannot be called
|
||||
@@ -399,6 +419,7 @@ public class MigrationHelperTests : IDisposable
|
||||
{
|
||||
private readonly ScadaBridgeDbContext _context;
|
||||
|
||||
/// <summary>Creates the test class with a fresh in-memory database context.</summary>
|
||||
public MigrationHelperTests()
|
||||
{
|
||||
// Use SQLite with PendingModelChangesWarning suppressed because the migration
|
||||
@@ -412,12 +433,15 @@ public class MigrationHelperTests : IDisposable
|
||||
_context.Database.OpenConnection();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by the test fixture.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Database.CloseConnection();
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that production mode throws when migrations are pending.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task ApplyOrValidate_ProductionMode_WithPendingMigrations_Throws()
|
||||
{
|
||||
@@ -429,6 +453,7 @@ public class MigrationHelperTests : IDisposable
|
||||
Assert.Contains("pending migration", ex.Message, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the initial create migration exists.</summary>
|
||||
[Fact]
|
||||
public void MigrationExists_InitialCreate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user