23 lines
768 B
C#
23 lines
768 B
C#
using System.Reflection;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ManagementService.Tests;
|
|
|
|
public class ManagementPagingBoundaryTests
|
|
{
|
|
[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]);
|
|
}
|
|
}
|