513fa1aa16
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.
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using System.Reflection;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
|
|
|
public class ManagementPagingBoundaryTests
|
|
{
|
|
/// <summary>Verifies that a positive take is capped, while an omitted or non-positive take preserves unlimited paging.</summary>
|
|
/// <param name="take">The requested page size, or null when omitted.</param>
|
|
/// <param name="expected">The number of rows expected back.</param>
|
|
[Theory]
|
|
[InlineData(null, 1100)]
|
|
[InlineData(-1, 1100)]
|
|
[InlineData(0, 1100)]
|
|
[InlineData(1, 1)]
|
|
[InlineData(1000, 1000)]
|
|
[InlineData(1001, 1000)]
|
|
[InlineData(int.MaxValue, 1000)]
|
|
public void PositiveTakeIsCapped_OmittedOrNonpositiveTakePreservesUnlimited(int? take, int expected)
|
|
{
|
|
var page = typeof(ManagementActor).GetMethod("Page", BindingFlags.Static | BindingFlags.NonPublic)!.MakeGenericMethod(typeof(int));
|
|
var rows = (List<int>)page.Invoke(null, [Enumerable.Range(0, 1100), -1, take])!;
|
|
Assert.Equal(expected, rows.Count);
|
|
Assert.Equal(0, rows[0]);
|
|
}
|
|
}
|