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:
+42
-8
@@ -33,6 +33,7 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
{
|
||||
private readonly ServiceProvider _provider;
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>BundleImporterPreviewTests</c> class.</summary>
|
||||
public BundleImporterPreviewTests()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
@@ -52,7 +53,7 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
services.AddScoped<IExternalSystemRepository, ExternalSystemRepository>();
|
||||
services.AddScoped<INotificationRepository, NotificationRepository>();
|
||||
services.AddScoped<IInboundApiRepository, InboundApiRepository>();
|
||||
// M8: DependencyResolver now injects ISiteRepository to walk the
|
||||
// DependencyResolver now injects ISiteRepository to walk the
|
||||
// site/data-connection/instance closure; register it or activation fails.
|
||||
services.AddScoped<ISiteRepository, SiteRepository>();
|
||||
services.AddScoped<IAuditCorrelationContext, AuditCorrelationContext>();
|
||||
@@ -62,6 +63,7 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
_provider = services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources used by this instance.</summary>
|
||||
public void Dispose() => _provider.Dispose();
|
||||
|
||||
private async Task<Stream> ExportTemplatesAsync()
|
||||
@@ -224,6 +226,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
NativeAlarmSourceOverrides: Array.Empty<InstanceNativeAlarmSourceOverrideDto>(),
|
||||
ConnectionBindings: bindings ?? Array.Empty<InstanceConnectionBindingDto>());
|
||||
|
||||
/// <summary>Verifies that PreviewAsync classifies an artifact as identical when its fields match.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_classifies_artifact_as_Identical_when_fields_match()
|
||||
{
|
||||
@@ -255,6 +259,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Null(pumpItem.FieldDiffJson);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync classifies an artifact as modified and reports the field diff.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_classifies_artifact_as_Modified_with_field_diff()
|
||||
{
|
||||
@@ -299,6 +305,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Contains("Description", pumpItem.FieldDiffJson!, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync classifies an artifact as new when it is absent from the target.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_classifies_artifact_as_New_when_absent_from_target()
|
||||
{
|
||||
@@ -338,10 +346,12 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Null(pumpItem.FieldDiffJson);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync classifies an unchanged structured template as identical.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_unchanged_structured_template_classifies_Identical()
|
||||
{
|
||||
// #05-T23 end-to-end: a template with a base (ParentTemplateId) and a
|
||||
// End-to-end: a template with a base (ParentTemplateId) and a
|
||||
// composition, re-imported against an UNCHANGED target, must classify
|
||||
// Identical. Before T23, PreviewAsync compared "<id:N>" placeholders for
|
||||
// BaseTemplateName / composition target against the bundle's real names,
|
||||
@@ -383,6 +393,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Equal(ConflictKind.Identical, pumpItem.Kind);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits a warning when a template script dependency is missing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_emits_Warning_when_template_script_dependency_missing()
|
||||
{
|
||||
@@ -392,7 +404,7 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
// selection that only pulls the template — the bundle won't carry
|
||||
// MissingHelper (it doesn't exist anywhere) so the preview must flag it.
|
||||
//
|
||||
// Under #05-T19 a TEMPLATE-script name-resolution finding is ADVISORY
|
||||
// A TEMPLATE-script name-resolution finding is ADVISORY
|
||||
// (the design-time deploy gate re-validates it), so the preview surfaces
|
||||
// it as ConflictKind.Warning — NOT a Blocker.
|
||||
await using (var scope = _provider.CreateAsyncScope())
|
||||
@@ -431,10 +443,12 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.DoesNotContain(preview.Items, i => i.Name == "HelperFn");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits a blocker when an API method dependency is missing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_emits_Blocker_when_ApiMethod_dependency_missing()
|
||||
{
|
||||
// #05-T19 severity split: an ApiMethod script referencing a missing
|
||||
// Severity split: an ApiMethod script referencing a missing
|
||||
// dependency has no downstream deploy gate, so the preview must surface
|
||||
// it as a hard Blocker (parity with the apply-time SemanticValidationException).
|
||||
await using (var scope = _provider.CreateAsyncScope())
|
||||
@@ -479,10 +493,12 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
&& i.BlockerReason.Contains("MissingHelper", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits a blocker when a template script uses a forbidden API.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_emits_Blocker_when_template_script_has_forbidden_api()
|
||||
{
|
||||
// #05-T20 — the script trust gate runs in preview too, so a forbidden-API
|
||||
// The script trust gate runs in preview too, so a forbidden-API
|
||||
// script surfaces as a Blocker row (parity with the apply-time
|
||||
// SemanticValidationException). Trust violations block regardless of kind.
|
||||
await using (var scope = _provider.CreateAsyncScope())
|
||||
@@ -511,6 +527,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
&& i.BlockerReason.Contains("Process", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync does not flag OPC UA tag paths in a data source reference as blockers.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_does_not_flag_opcua_tag_paths_in_DataSourceReference_as_blockers()
|
||||
{
|
||||
@@ -550,6 +568,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
i.Kind == ConflictKind.Blocker && i.Name == "Tank");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync does not flag standard-library or runtime member accesses as blockers.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_does_not_flag_stdlib_or_runtime_member_accesses_as_blockers()
|
||||
{
|
||||
@@ -599,10 +619,12 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync diffs each of several templates with children correctly.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_multiple_templates_with_children_diffs_each_correctly()
|
||||
{
|
||||
// Transport-008 regression: PreviewAsync previously fetched each matching
|
||||
// Regression: PreviewAsync previously fetched each matching
|
||||
// template's children via a per-name GetTemplateWithChildrenAsync call
|
||||
// (N+1). The bulk variant returns every match in a single query — this
|
||||
// test seeds three templates with distinct child collections and asserts
|
||||
@@ -647,8 +669,10 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Equal(ConflictKind.Identical, tankItem.Kind);
|
||||
}
|
||||
|
||||
// ---- M8 C2: site/connection/instance preview + required-mapping detection + blockers ----
|
||||
// ---- Site/connection/instance preview + required-mapping detection + blockers ----
|
||||
|
||||
/// <summary>Verifies that PreviewAsync into a fresh target surfaces the required mappings with a null auto-match.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_into_fresh_target_surfaces_required_mappings_with_null_auto_match()
|
||||
{
|
||||
@@ -694,6 +718,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.Contains(preview.Items, i => i.EntityType == "DataConnection" && i.Name == "plant-1/OpcUaPrimary" && i.Kind == ConflictKind.New);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync into a populated target auto-matches the site and connection.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_into_populated_target_auto_matches_site_and_connection()
|
||||
{
|
||||
@@ -730,10 +756,12 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.DoesNotContain(preview.Items, i => i.Kind == ConflictKind.Blocker && i.EntityType == "Instance");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits two distinct site-qualified items for two sites sharing a connection name.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_two_sites_same_connection_name_emit_two_distinct_site_qualified_items()
|
||||
{
|
||||
// C2: a bundle with plant-1/OpcUaPrimary + plant-2/OpcUaPrimary must surface
|
||||
// A bundle with two sites (plant 1 and plant 2) each holding OpcUaPrimary must surface
|
||||
// TWO distinct DataConnection preview items, each site-qualified
|
||||
// ({site}/{name}) — NOT a single collapsed "OpcUaPrimary" item. This is what
|
||||
// lets the operator (and the apply path) resolve each site's connection
|
||||
@@ -782,6 +810,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.DoesNotContain(preview.Items, i => i.EntityType == "DataConnection" && i.Name == "OpcUaPrimary");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync for a modified instance against a hydrated target shows a child diff rather than everything as added.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_modified_instance_against_hydrated_target_shows_child_diff_not_all_added()
|
||||
{
|
||||
@@ -823,6 +853,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
Assert.DoesNotContain("\"ConnectionBindings\"", instItem.FieldDiffJson!, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits a blocker for an instance whose template is missing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_instance_with_missing_template_emits_blocker()
|
||||
{
|
||||
@@ -854,6 +886,8 @@ public sealed class BundleImporterPreviewTests : IDisposable
|
||||
&& i.BlockerReason.Contains("NoSuchTemplate", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that PreviewAsync emits a blocker when a referenced connection is absent from both the bundle and the target.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task PreviewAsync_referenced_connection_absent_from_bundle_and_target_emits_blocker()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user