11using System . Collections . Generic ;
2- using Bunq . Sdk . Context ;
32using Bunq . Sdk . Exception ;
43using Bunq . Sdk . Http ;
5- using Bunq . Sdk . Json ;
6- using Bunq . Sdk . Model . Generated ;
7- using Bunq . Sdk . Model . Generated . Object ;
84using Xunit ;
95
106namespace Bunq . Sdk . Tests . Http
@@ -15,13 +11,6 @@ namespace Bunq.Sdk.Tests.Http
1511 /// </summary>
1612 public class PaginationTest : BunqSdkTestBase
1713 {
18- /// <summary>
19- /// Config values.
20- /// </summary>
21- private static readonly int USER_ID = Config . GetUserId ( ) ;
22- private static readonly int MONETARY_ACCOUNT_ID = Config . GetMonetarytAccountId ( ) ;
23- private static readonly Pointer COUNTER_PARTY_OTHER = Config . GetCounterAliasOther ( ) ;
24-
2514 /// <summary>
2615 /// Values of pagination properties for testing.
2716 /// </summary>
@@ -30,25 +19,6 @@ public class PaginationTest : BunqSdkTestBase
3019 private const int PAGINATION_FUTURE_ID_CUSTOM = 3 ;
3120 private const int PAGINATION_COUNT_CUSTOM = 5 ;
3221
33- /// <summary>
34- /// Constants for scenario testing.
35- /// </summary>
36- private const int PAYMENT_LISTING_PAGE_SIZE = 2 ;
37- private const int PAYMENT_REQUIRED_COUNT_MINIMUM = PAYMENT_LISTING_PAGE_SIZE * 2 ;
38- private const int NUMBER_ZERO = 0 ;
39-
40- /// <summary>
41- /// Constants for payment creation.
42- /// </summary>
43- private const string AMOUNT_IN_EUR = "0.01" ;
44- private const string FIELD_CURRENCY = "EUR" ;
45- private const string FIELD_PAYMENT_DESCRIPTION = "C# test Payment" ;
46-
47- /// <summary>
48- /// API context to use for the test API calls.
49- /// </summary>
50- private static readonly ApiContext API_CONTEXT = GetApiContext ( ) ;
51-
5222 [ Fact ]
5323 public void TestGetUrlParamsCountOnly ( )
5424 {
@@ -152,70 +122,5 @@ private static Pagination CreatePaginationWithNoNextPage()
152122
153123 return pagination ;
154124 }
155-
156- [ Fact ]
157- public void TestApiScenarioPaymentListingWithPagination ( )
158- {
159- EnsureEnoughPayments ( ) ;
160- var paymentsExpected = new HashSet < Payment > ( GetPaymentsRequired ( ) ) ;
161- var paginationCountOnly = new Pagination
162- {
163- Count = PAYMENT_LISTING_PAGE_SIZE
164- } ;
165-
166- var paymentResponseLatest = ListPayments ( paginationCountOnly . UrlParamsCountOnly ) ;
167- var paginationLatest = paymentResponseLatest . Pagination ;
168- var paymentResponsePrevious = ListPayments ( paginationLatest . UrlParamsPreviousPage ) ;
169- var paginationPrevious = paymentResponsePrevious . Pagination ;
170- var paymentResponsePreviousNext = ListPayments ( paginationPrevious . UrlParamsNextPage ) ;
171-
172- var paymentsActual = new HashSet < Payment > ( ) ;
173- paymentsActual . UnionWith ( paymentResponsePreviousNext . Value ) ;
174- paymentsActual . UnionWith ( paymentResponsePrevious . Value ) ;
175- var paymentsExpectedSerialized = BunqJsonConvert . SerializeObject ( paymentsExpected ) ;
176- var paymentsActualSerialized = BunqJsonConvert . SerializeObject ( paymentsActual ) ;
177-
178- Assert . Equal ( paymentsExpectedSerialized , paymentsActualSerialized ) ;
179- }
180-
181- private static void EnsureEnoughPayments ( )
182- {
183- for ( var i = NUMBER_ZERO ; i < GetPaymentsMissingCount ( ) ; ++ i )
184- {
185- CreatePayment ( ) ;
186- }
187- }
188-
189- private static int GetPaymentsMissingCount ( )
190- {
191- return PAYMENT_REQUIRED_COUNT_MINIMUM - GetPaymentsRequired ( ) . Count ;
192- }
193-
194- private static List < Payment > GetPaymentsRequired ( )
195- {
196- var pagination = new Pagination
197- {
198- Count = PAYMENT_REQUIRED_COUNT_MINIMUM
199- } ;
200-
201- return ListPayments ( pagination . UrlParamsCountOnly ) . Value ;
202- }
203-
204- private static BunqResponse < List < Payment > > ListPayments ( IDictionary < string , string > urlParams )
205- {
206- return Payment . List ( API_CONTEXT , USER_ID , MONETARY_ACCOUNT_ID , urlParams ) ;
207- }
208-
209- private static void CreatePayment ( )
210- {
211- var requestMap = new Dictionary < string , object >
212- {
213- { Payment . FIELD_AMOUNT , new Amount ( AMOUNT_IN_EUR , FIELD_CURRENCY ) } ,
214- { Payment . FIELD_DESCRIPTION , FIELD_PAYMENT_DESCRIPTION } ,
215- { Payment . FIELD_COUNTERPARTY_ALIAS , COUNTER_PARTY_OTHER }
216- } ;
217-
218- Payment . Create ( API_CONTEXT , requestMap , USER_ID , MONETARY_ACCOUNT_ID ) ;
219- }
220125 }
221126}
0 commit comments