11using System ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
34using Bunq . Sdk . Context ;
45using Bunq . Sdk . Model . Generated . Endpoint ;
56using Bunq . Sdk . Model . Generated . Object ;
@@ -25,13 +26,14 @@ public class CardDebitTest : BunqSdkTestBase
2526 private const int BASE_DECIMAL = 10 ;
2627 private const int CARD_SECOND_LINE_LENGTH_MAXIMUM = 20 ;
2728 private const int NUMBER_ONE = 1 ;
29+ private const string CardTypeMaestro = "MAESTRO" ;
2830
2931 private static readonly int USER_ID = Config . GetUserId ( ) ;
3032
3133 /// <summary>
3234 /// API context used to for the test API calls.
3335 /// </summary>
34- private static readonly ApiContext API_CONTEXT = GetApiContext ( ) ;
36+ private static readonly ApiContext API_CONTEXT = SetUpApiContext ( ) ;
3537
3638 /// <summary>
3739 /// Tests ordering a new card and checks if the fields we have entered are indeed correct by.
@@ -40,20 +42,16 @@ public class CardDebitTest : BunqSdkTestBase
4042 public void TestOrderNewMaestroCard ( )
4143 {
4244 var cardPinAssignment = new CardPinAssignment (
43- CARD_PIN_ASSIGNMENT_TYPE_PRIMARY ,
45+ CARD_PIN_ASSIGNMENT_TYPE_PRIMARY ,
4446 PIN_CODE ,
4547 Config . GetMonetarytAccountId ( ) ) ;
4648 var allCardPinAssignments = new List < CardPinAssignment > { cardPinAssignment } ;
47- var cardDebitMap = new Dictionary < string , object >
48- {
49- { CardDebit . FIELD_ALIAS , GetAlias ( ) } ,
50- { CardDebit . FIELD_NAME_ON_CARD , GetAnAllowedName ( ) } ,
51- { CardDebit . FIELD_PIN_CODE_ASSIGNMENT , allCardPinAssignments } ,
52- { CardDebit . FIELD_SECOND_LINE , GenerateRandomSecondLine ( ) }
53- } ;
54- var cardDebit = CardDebit . Create ( API_CONTEXT , cardDebitMap , USER_ID ) . Value ;
49+ var cardDebit = CardDebit . Create ( GenerateRandomSecondLine ( ) , GetAnAllowedName ( ) , GetAlias ( ) , CardTypeMaestro ,
50+ allCardPinAssignments ) . Value ;
5551
56- var cardFromCardEndpoint = Card . Get ( API_CONTEXT , USER_ID , cardDebit . Id . Value ) . Value ;
52+ Assert . True ( cardDebit . Id != null ) ;
53+
54+ var cardFromCardEndpoint = Card . Get ( cardDebit . Id . Value ) . Value ;
5755
5856 Assert . Equal ( cardDebit . SecondLine , cardFromCardEndpoint . SecondLine ) ;
5957 Assert . Equal ( cardDebit . Created , cardFromCardEndpoint . Created ) ;
@@ -62,7 +60,7 @@ public void TestOrderNewMaestroCard()
6260
6361 private static string GetAnAllowedName ( )
6462 {
65- return CardName . List ( API_CONTEXT , USER_ID ) . Value [ INDEX_FIRST ] . PossibleCardNameArray [ INDEX_FIRST ] ;
63+ return CardName . List ( ) . Value [ INDEX_FIRST ] . PossibleCardNameArray [ INDEX_FIRST ] ;
6664 }
6765
6866 private static string GenerateRandomSecondLine ( )
@@ -77,7 +75,7 @@ private static string GenerateRandomSecondLine()
7775
7876 private static Pointer GetAlias ( )
7977 {
80- return User . Get ( API_CONTEXT , USER_ID ) . Value . UserCompany . Alias [ INDEX_FIRST ] ;
78+ return User . Get ( ) . Value . UserCompany . Alias [ INDEX_FIRST ] ;
8179 }
8280 }
8381}
0 commit comments