@@ -9,9 +9,13 @@ namespace UnitTests.QueryParameters
99{
1010 public class PageServiceTests : QueryParametersUnitTestCollection
1111 {
12- public PageService GetService ( )
12+ public PageService GetService ( int ? maximumPageSize = null , int ? maximumPageNumber = null )
1313 {
14- return new PageService ( new JsonApiOptions ( ) ) ;
14+ return new PageService ( new JsonApiOptions
15+ {
16+ MaximumPageSize = maximumPageSize ,
17+ MaximumPageNumber = maximumPageNumber
18+ } ) ;
1519 }
1620
1721 [ Fact ]
@@ -28,14 +32,16 @@ public void Name_PageService_IsCorrect()
2832 }
2933
3034 [ Theory ]
31- [ InlineData ( "1" , 1 , false ) ]
32- [ InlineData ( "abcde" , 0 , true ) ]
33- [ InlineData ( "" , 0 , true ) ]
34- public void Parse_PageSize_CanParse ( string value , int expectedValue , bool shouldThrow )
35+ [ InlineData ( "1" , 1 , null , false ) ]
36+ [ InlineData ( "abcde" , 0 , null , true ) ]
37+ [ InlineData ( "" , 0 , null , true ) ]
38+ [ InlineData ( "5" , 5 , 10 , false ) ]
39+ [ InlineData ( "5" , 5 , 3 , true ) ]
40+ public void Parse_PageSize_CanParse ( string value , int expectedValue , int ? maximumPageSize , bool shouldThrow )
3541 {
3642 // Arrange
3743 var query = new KeyValuePair < string , StringValues > ( $ "page[size]", new StringValues ( value ) ) ;
38- var service = GetService ( ) ;
44+ var service = GetService ( maximumPageSize : maximumPageSize ) ;
3945
4046 // Act
4147 if ( shouldThrow )
@@ -51,15 +57,16 @@ public void Parse_PageSize_CanParse(string value, int expectedValue, bool should
5157 }
5258
5359 [ Theory ]
54- [ InlineData ( "1" , 1 , false ) ]
55- [ InlineData ( "abcde" , 0 , true ) ]
56- [ InlineData ( "" , 0 , true ) ]
57- public void Parse_PageNumber_CanParse ( string value , int expectedValue , bool shouldThrow )
60+ [ InlineData ( "1" , 1 , null , false ) ]
61+ [ InlineData ( "abcde" , 0 , null , true ) ]
62+ [ InlineData ( "" , 0 , null , true ) ]
63+ [ InlineData ( "5" , 5 , 10 , false ) ]
64+ [ InlineData ( "5" , 5 , 3 , true ) ]
65+ public void Parse_PageNumber_CanParse ( string value , int expectedValue , int ? maximumPageNumber , bool shouldThrow )
5866 {
5967 // Arrange
6068 var query = new KeyValuePair < string , StringValues > ( $ "page[number]", new StringValues ( value ) ) ;
61- var service = GetService ( ) ;
62-
69+ var service = GetService ( maximumPageNumber : maximumPageNumber ) ;
6370
6471 // Act
6572 if ( shouldThrow )
0 commit comments