@@ -291,7 +291,63 @@ public void GetSubscriptionSearchCardExpiringThisMonthFixTest()
291
291
Assert . IsNotNull ( arbGetSubscriptionListResponse ) ;
292
292
}
293
293
294
+ private ARBGetSubscriptionListResponse GetSubscriptionListResponse ( int limitNo , int offSetNo )
295
+ {
296
+ var getSubscriptionList = new ARBGetSubscriptionListRequest ( )
297
+ {
298
+ searchType = ARBGetSubscriptionListSearchTypeEnum . subscriptionActive ,
299
+ paging = new Paging ( )
300
+ {
301
+ limit = limitNo ,
302
+ offset = offSetNo
303
+ } ,
304
+
305
+ } ;
306
+
307
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . MerchantAuthentication = CustomMerchantAuthenticationType ;
308
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment = TestEnvironment ;
309
+ var arbGetSubscriptionListController = new ARBGetSubscriptionListController ( getSubscriptionList ) ;
310
+ var arbGetSubscriptionListResponse = arbGetSubscriptionListController . ExecuteWithApiResponse ( ) ;
311
+ return arbGetSubscriptionListResponse ;
312
+
313
+ }
314
+ /// <summary>
315
+ /// @Zalak
316
+ /// Test case for Pagination issue reported in Jira:
317
+ /// C# - ARBSubscriptionList SearchType of "cardExpiringThisMonth" doesn't work
318
+ /// </summary>
319
+ [ Test ]
320
+ public void ARBGetSubscriptionListCheckPagination ( )
321
+ {
294
322
323
+ var arbGetSubscriptionListResponse = GetSubscriptionListResponse ( 1 , 1 ) ;
324
+ ARBGetSubscriptionListResponse response = null ;
325
+ int limitNo = 3 ;
326
+ int offSetNo = 2 ;
327
+
328
+ if ( arbGetSubscriptionListResponse != null )
329
+ {
330
+ int subcriptionNumber = arbGetSubscriptionListResponse . totalNumInResultSet ;
331
+ int expectedSubscriptionNo = 0 ;
332
+ int nPages = subcriptionNumber / limitNo ;
333
+ int subscriptionDetailsOnLastPage = subcriptionNumber % limitNo ;
334
+ if ( offSetNo <= nPages )
335
+ expectedSubscriptionNo = limitNo ;
336
+ else if ( offSetNo > ( nPages + 1 ) )
337
+ expectedSubscriptionNo = 0 ;
338
+ else
339
+ {
340
+ expectedSubscriptionNo = subscriptionDetailsOnLastPage ;
341
+ }
342
+ response = GetSubscriptionListResponse ( limitNo , offSetNo ) ;
343
+ Assert . AreEqual ( expectedSubscriptionNo , response . subscriptionDetails . Count ( ) ) ;
344
+ }
345
+ else
346
+ {
347
+ Assert . Null ( arbGetSubscriptionListResponse ) ;
348
+ }
349
+
350
+ }
295
351
296
352
297
353
private ARBCreateSubscriptionController CreateSubscriptionRequestTest ( ARBSubscriptionType subscriptionRequestParameter )
0 commit comments