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:
+27
-3
@@ -11,6 +11,7 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
private readonly ScadaBridgeDbContext _context;
|
||||
private readonly TemplateEngineRepository _repository;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="TemplateEngineRepositoryTests"/> class.</summary>
|
||||
public TemplateEngineRepositoryTests()
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
|
||||
@@ -23,12 +24,15 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
_repository = new TemplateEngineRepository(_context, new TemplateGraphWatermark());
|
||||
}
|
||||
|
||||
/// <summary>Closes the connection and disposes the database context.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Database.CloseConnection();
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the topology page is bounded, filtered and returned untracked.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task TopologyPage_IsBoundedFilteredAndUntracked()
|
||||
{
|
||||
@@ -53,6 +57,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => _repository.GetTopologyInstancesAsync(site.Id, null, 0, 51));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that loading a template with children returns it with all member collections populated.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplateWithChildrenAsync_ReturnsTemplateWithAllMemberCollectionsPopulated()
|
||||
{
|
||||
@@ -73,7 +79,7 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
var loaded = await _repository.GetTemplateWithChildrenAsync(template.Id);
|
||||
|
||||
// Assert: the method must deliver the template's child members to the caller,
|
||||
// not silently drop them. Regression guard for ConfigurationDatabase-001.
|
||||
// not silently drop them. Regression guard for dropped child members.
|
||||
Assert.NotNull(loaded);
|
||||
Assert.Equal(template.Id, loaded!.Id);
|
||||
Assert.Single(loaded.Attributes);
|
||||
@@ -86,10 +92,12 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Equal("Slot1", loaded.Compositions.First().InstanceName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a template script's execution timeout in seconds round-trips through EF.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task TemplateScript_ExecutionTimeoutSeconds_RoundTripsThroughEf()
|
||||
{
|
||||
// M2.5 (#9): the nullable per-script execution timeout must persist and
|
||||
// The nullable per-script execution timeout must persist and
|
||||
// reload through EF — both an explicit value and a null (use-global).
|
||||
var template = new Template("TimeoutTemplate");
|
||||
template.Scripts.Add(new TemplateScript("WithTimeout", "return 1;")
|
||||
@@ -114,6 +122,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Null(noTimeout.ExecutionTimeoutSeconds);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that loading a template with children returns null when the template does not exist.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplateWithChildrenAsync_ReturnsNull_WhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -122,10 +132,12 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Null(loaded);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the bulk variant fetches every matching template name in one query.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplatesWithChildrenAsync_BulkVariant_FetchesEveryMatchingNameInOneQuery()
|
||||
{
|
||||
// Transport-008 regression: BundleImporter.PreviewAsync previously
|
||||
// Regression: BundleImporter.PreviewAsync previously
|
||||
// called GetTemplateWithChildrenAsync(stub.Id) per matching template
|
||||
// name. The bulk variant returns every match in a single query.
|
||||
var a = new Template("Alpha");
|
||||
@@ -150,6 +162,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.DoesNotContain(result, t => t.Name == "Gamma");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the bulk variant returns an empty result for an empty list of names.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplatesWithChildrenAsync_EmptyNames_ReturnsEmpty()
|
||||
{
|
||||
@@ -158,6 +172,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the bulk variant returns an empty result for a null enumerable.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplatesWithChildrenAsync_NullEnumerable_ReturnsEmpty()
|
||||
{
|
||||
@@ -166,6 +182,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the bulk variant filters out duplicate and empty names.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplatesWithChildrenAsync_FiltersOutDuplicatesAndEmptyStrings()
|
||||
{
|
||||
@@ -182,6 +200,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Equal("Alpha", result[0].Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the parent template id is preserved so the inheritance chain can be walked.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplateWithChildrenAsync_PreservesParentTemplateId_ForInheritanceChainWalk()
|
||||
{
|
||||
@@ -201,6 +221,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Equal(baseTemplate.Id, loaded!.ParentTemplateId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that native alarm sources added for a template round-trip when queried by template id.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task AddAndGetNativeAlarmSourcesByTemplateId_RoundTrips()
|
||||
{
|
||||
@@ -217,6 +239,8 @@ public class TemplateEngineRepositoryTests : IDisposable
|
||||
Assert.Equal("S", list[0].Name);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that loading a template with children includes its native alarm sources.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetTemplateWithChildren_IncludesNativeAlarmSources()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user