public static (int count, int skip) CorrectPagination(
int totalCount,
int count,
int skip,
int defaultCount = 10);
// Example
return (10, 20); // count = 10, skip = 20
return (count: 10, skip: 20);
Contract:
totalCount >= 0
defaultCount > 0
(should throw an appropriate exception)
Acceptance criteria:
var (count, skip) = CorrectPagination(totalCount, requestedCount, requestSkip, defaultCount);
Create a function with following signature:
Contract:
totalCount >= 0
defaultCount > 0
(should throw an appropriate exception)
Acceptance criteria:
count > 0
skip >= 0
skip == 0 || skip < totalCount
count == requestedCount || requestedCount <= 0 && count == defaultCount
skip == requestedSkip || requestedSkip < 0 || requestedSkip >= totalCount