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:
+35
-3
@@ -9,7 +9,7 @@ using ZB.MOM.WW.ScadaBridge.KpiHistory;
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service-level tests for <see cref="KpiHistoryQueryService"/> (M6 K11). The
|
||||
/// Service-level tests for <see cref="KpiHistoryQueryService"/>. The
|
||||
/// service fetches a raw series via <see cref="IKpiHistoryRepository.GetRawSeriesAsync"/>
|
||||
/// and reduces it with <see cref="KpiSeriesBucketer"/>; these tests pin the
|
||||
/// argument-forwarding contract, the bucketer pass-through, and the
|
||||
@@ -30,6 +30,8 @@ public class KpiHistoryQueryServiceTests
|
||||
private static IReadOnlyList<KpiSeriesPoint> Series(params (int minute, double value)[] pts) =>
|
||||
pts.Select(p => new KpiSeriesPoint(From.AddMinutes(p.minute), p.value)).ToList();
|
||||
|
||||
/// <summary>Verifies that all arguments are forwarded to the repository.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_ForwardsAllArgs_ToRepository()
|
||||
{
|
||||
@@ -50,6 +52,8 @@ public class KpiHistoryQueryServiceTests
|
||||
From, To, Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null scope key is forwarded to the repository for a global scope.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_ForwardsNullScopeKey_ForGlobalScope()
|
||||
{
|
||||
@@ -70,6 +74,8 @@ public class KpiHistoryQueryServiceTests
|
||||
From, To, Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the raw series is returned unchanged when its point count is within the maximum.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_ReturnsRawUnchanged_WhenCountWithinMax()
|
||||
{
|
||||
@@ -89,6 +95,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.Same(raw, result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null maximum point count falls back to the default from the options.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_NullMaxPoints_UsesDefaultFromOptions()
|
||||
{
|
||||
@@ -110,6 +118,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.True(result.Count <= 2);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an explicit maximum point count overrides the default.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_ExplicitMaxPoints_OverridesDefault()
|
||||
{
|
||||
@@ -132,6 +142,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.Same(raw, result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an empty series yields an empty result.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_EmptySeries_ReturnsEmpty()
|
||||
{
|
||||
@@ -148,6 +160,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the production constructor opens a fresh service scope for each call.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_OpensFreshScopePerCall_OnProductionCtor()
|
||||
{
|
||||
@@ -181,7 +195,7 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.NotSame(resolvedRepos[0], resolvedRepos[1]);
|
||||
}
|
||||
|
||||
// ---- Task 5: raw-vs-rollup range routing by RollupThresholdHours ----------------
|
||||
// ---- raw-vs-rollup range routing by RollupThresholdHours ----------------
|
||||
|
||||
private static IKpiHistoryRepository RepoReturningEmptyForBoth()
|
||||
{
|
||||
@@ -197,6 +211,8 @@ public class KpiHistoryQueryServiceTests
|
||||
return repo;
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a 24-hour window uses the raw query path.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_24hWindow_UsesRawPath()
|
||||
{
|
||||
@@ -215,6 +231,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Arg.Any<DateTime>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a window exactly at the threshold uses the raw query path.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_WindowExactlyAtThreshold_UsesRawPath()
|
||||
{
|
||||
@@ -234,6 +252,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Arg.Any<DateTime>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a window just over the threshold uses the rollup query path.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_WindowJustOverThreshold_UsesRollupPath()
|
||||
{
|
||||
@@ -253,6 +273,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Arg.Any<DateTime>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a 90-day window uses the rollup query path.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_90dWindow_UsesRollupPath()
|
||||
{
|
||||
@@ -271,6 +293,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Arg.Any<DateTime>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the rollup path still buckets the series when it exceeds the maximum point count.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_RollupPath_StillBucketsWhenOverMax()
|
||||
{
|
||||
@@ -303,6 +327,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.True(result.Count <= 3);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a long window uses the rollup path when built through the production constructor.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_LongWindow_UsesRollupPath_OnProductionCtor()
|
||||
{
|
||||
@@ -331,8 +357,10 @@ public class KpiHistoryQueryServiceTests
|
||||
Arg.Any<DateTime>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
// ---- Task 6: catalog-driven aggregation at the bucketer boundary (R3) -----------
|
||||
// ---- catalog-driven aggregation at the bucketer boundary (R3) -----------
|
||||
|
||||
/// <summary>Verifies that a rate metric is summed per bucket on the rollup path.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_RateMetric_SumsPerBucket_OnRollupPath()
|
||||
{
|
||||
@@ -361,6 +389,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.All(result, p => Assert.Equal(2.0, p.Value));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a rate metric preserves its total across the raw-to-rollup routing boundary.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_RateMetric_PreservesTotal_AcrossRoutingBoundary()
|
||||
{
|
||||
@@ -399,6 +429,8 @@ public class KpiHistoryQueryServiceTests
|
||||
Assert.Equal(rawResult.Sum(p => p.Value), rollupResult.Sum(p => p.Value));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a gauge metric keeps the last value in each bucket.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSeriesAsync_GaugeMetric_KeepsLastValuePerBucket()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user