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:
+20
-2
@@ -8,7 +8,7 @@ using AuditOutcome = ZB.MOM.WW.Audit.AuditOutcome;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Configurations;
|
||||
|
||||
/// <summary>
|
||||
/// Schema-level tests for the C5 (Task 2.5) <see cref="AuditLogEntityTypeConfiguration"/>.
|
||||
/// Schema-level tests for the C5 <see cref="AuditLogEntityTypeConfiguration"/>.
|
||||
/// After the central <c>dbo.AuditLog</c> collapse the table is the 10 canonical
|
||||
/// <c>ZB.MOM.WW.Audit.AuditEvent</c> columns plus six read-only <b>persisted computed
|
||||
/// columns</b> derived from <c>DetailsJson</c>. Verifies the PK, the canonical/computed
|
||||
@@ -22,17 +22,20 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
{
|
||||
private readonly ScadaBridgeDbContext _context;
|
||||
|
||||
/// <summary>Creates the test fixture and its database context.</summary>
|
||||
public AuditLogEntityTypeConfigurationTests()
|
||||
{
|
||||
_context = SqliteTestHelper.CreateInMemoryContext();
|
||||
}
|
||||
|
||||
/// <summary>Closes the connection and disposes the database context.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Database.CloseConnection();
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the configuration maps to the AuditLog table with a composite primary key.</summary>
|
||||
[Fact]
|
||||
public void Configure_MapsToAuditLogTable_WithCompositePrimaryKey()
|
||||
{
|
||||
@@ -51,10 +54,11 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(new[] { nameof(AuditLogRow.EventId), nameof(AuditLogRow.OccurredAtUtc) }, pkPropertyNames);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that no non-aligned EventId index is declared and uniqueness rides the aligned clustered key.</summary>
|
||||
[Fact]
|
||||
public void Configure_DeclaresNoNonAlignedEventIdIndex_UniquenessRidesTheAlignedClusteredKey()
|
||||
{
|
||||
// WP2.2 (AlignAuditLogEventIdUniqueness): the standalone non-aligned
|
||||
// AlignAuditLogEventIdUniqueness: the standalone non-aligned
|
||||
// UX_AuditLog_EventId is gone. EventId uniqueness now rides the clustered
|
||||
// PK (EventId, OccurredAtUtc), which is partition-aligned on
|
||||
// ps_AuditLog_Month — so ALTER TABLE ... SWITCH PARTITION no longer needs
|
||||
@@ -79,6 +83,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
pk!.Properties.Select(p => p.Name).ToArray());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the configuration maps the expected number of properties.</summary>
|
||||
[Fact]
|
||||
public void Configure_HasExpectedPropertyCount()
|
||||
{
|
||||
@@ -96,6 +101,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(16, properties.Count);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the channel property maps to the canonical category column.</summary>
|
||||
[Fact]
|
||||
public void Configure_ChannelMapsToCanonicalCategoryColumn()
|
||||
{
|
||||
@@ -109,6 +115,9 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal("Category", channel!.GetColumnName());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that each computed column has the expected persisted SQL expression.</summary>
|
||||
/// <param name="propertyName">The name of the computed property.</param>
|
||||
/// <param name="expectedSql">The expected computed-column SQL.</param>
|
||||
[Theory]
|
||||
[InlineData(nameof(AuditLogRow.Kind), "JSON_VALUE(DetailsJson,'$.kind')")]
|
||||
[InlineData(nameof(AuditLogRow.Status), "JSON_VALUE(DetailsJson,'$.status')")]
|
||||
@@ -132,6 +141,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.OnAddOrUpdate, property.ValueGenerated);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the IngestedAtUtc property is a non-persisted computed column.</summary>
|
||||
[Fact]
|
||||
public void Configure_IngestedAtUtc_IsNonPersistedComputedColumn()
|
||||
{
|
||||
@@ -150,6 +160,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.OnAddOrUpdate, property.ValueGenerated);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the expected indexes exist with the correct names.</summary>
|
||||
[Fact]
|
||||
public void Configure_ExpectedIndexes_WithCorrectNames()
|
||||
{
|
||||
@@ -180,6 +191,8 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(expected, indexNames);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that each enum column is stored as a varchar(32).</summary>
|
||||
/// <param name="propertyName">The name of the enum property.</param>
|
||||
[Theory]
|
||||
[InlineData(nameof(AuditLogRow.Kind))]
|
||||
[InlineData(nameof(AuditLogRow.Status))]
|
||||
@@ -198,6 +211,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.False(property.IsUnicode() ?? true);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the outcome column is stored as a varchar(16).</summary>
|
||||
[Fact]
|
||||
public void Configure_Outcome_StoredAsVarchar16()
|
||||
{
|
||||
@@ -211,6 +225,8 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.False(property.IsUnicode() ?? true);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the UTC converter hydrates OccurredAtUtc with a UTC kind.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Configure_UtcConverter_HydratesOccurredAtUtcAsKindUtc()
|
||||
{
|
||||
@@ -252,6 +268,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(unspecifiedOccurred.Ticks, loaded.OccurredAtUtc.Ticks);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that OccurredAtUtc and IngestedAtUtc have UTC value converters.</summary>
|
||||
[Fact]
|
||||
public void Configure_OccurredAtUtcAndIngestedAtUtc_HaveUtcValueConverters()
|
||||
{
|
||||
@@ -269,6 +286,7 @@ public class AuditLogEntityTypeConfigurationTests : IDisposable
|
||||
Assert.NotNull(ingestedAt!.GetValueConverter());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the filtered indexes have the expected filter expressions.</summary>
|
||||
[Fact]
|
||||
public void Configure_FilteredIndexes_HaveExpectedFilters()
|
||||
{
|
||||
|
||||
+11
-2
@@ -6,28 +6,31 @@ using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Configurations;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Configurations;
|
||||
|
||||
/// <summary>
|
||||
/// Schema-level tests for <see cref="SiteCallEntityTypeConfiguration"/> (#22 / #23 M3 Bundle B).
|
||||
/// Schema-level tests for <see cref="SiteCallEntityTypeConfiguration"/>.
|
||||
/// Verifies the <see cref="SiteCall"/> record maps to the <c>SiteCalls</c> table with the
|
||||
/// expected primary key, value conversion on <c>TrackedOperationId</c>, and the two named
|
||||
/// indexes that back the "calls from this site" and "calls in this status" Central UI queries.
|
||||
/// Mirrors the AuditLog Bundle B test pattern — inspects EF model metadata via the existing
|
||||
/// Mirrors the AuditLog test pattern — inspects EF model metadata via the existing
|
||||
/// in-memory SQLite test context, no database round-trips required.
|
||||
/// </summary>
|
||||
public class SiteCallEntityTypeConfigurationTests : IDisposable
|
||||
{
|
||||
private readonly ScadaBridgeDbContext _context;
|
||||
|
||||
/// <summary>Initializes an in-memory SQLite context for the schema tests.</summary>
|
||||
public SiteCallEntityTypeConfigurationTests()
|
||||
{
|
||||
_context = SqliteTestHelper.CreateInMemoryContext();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources held by this test class.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Database.CloseConnection();
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the <c>SiteCall</c> entity maps to the <c>SiteCalls</c> table.</summary>
|
||||
[Fact]
|
||||
public void Configure_MapsToSiteCallsTable()
|
||||
{
|
||||
@@ -37,6 +40,7 @@ public class SiteCallEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal("SiteCalls", entity!.GetTableName());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the primary key is <c>TrackedOperationId</c>.</summary>
|
||||
[Fact]
|
||||
public void Configure_PrimaryKey_TrackedOperationId()
|
||||
{
|
||||
@@ -50,6 +54,7 @@ public class SiteCallEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(new[] { nameof(SiteCall.TrackedOperationId) }, pkPropertyNames);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the expected indexes exist with the right names and column order.</summary>
|
||||
[Fact]
|
||||
public void Configure_HasIndexes_NamedAndOrdered()
|
||||
{
|
||||
@@ -71,6 +76,7 @@ public class SiteCallEntityTypeConfigurationTests : IDisposable
|
||||
Assert.Equal(new[] { nameof(SiteCall.Status), nameof(SiteCall.UpdatedAtUtc) }, statusUpdatedProps);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that <c>TrackedOperationId</c> is converted to a string column of length 36.</summary>
|
||||
[Fact]
|
||||
public void Configure_TrackedOperationId_ConvertedToString_Length36()
|
||||
{
|
||||
@@ -90,6 +96,9 @@ public class SiteCallEntityTypeConfigurationTests : IDisposable
|
||||
Assert.False(property.IsUnicode() ?? true);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that each ASCII column is bounded to its expected maximum length.</summary>
|
||||
/// <param name="propertyName">The entity property name.</param>
|
||||
/// <param name="expectedMaxLength">The expected maximum column length.</param>
|
||||
[Theory]
|
||||
[InlineData(nameof(SiteCall.Channel), 32)]
|
||||
[InlineData(nameof(SiteCall.SourceSite), 64)]
|
||||
|
||||
Reference in New Issue
Block a user