public void Test_Users_BankAccounts() { try { UserNaturalDTO john = this.GetJohn(); BankAccountIbanDTO account = this.GetJohnsAccount(); Pagination pagination = new Pagination(1, 12); ListPaginated<BankAccountDTO> list = this.Api.Users.GetBankAccounts(john.Id, pagination); int listIndex; for (listIndex = 0; listIndex < list.Count; listIndex++) { if (list[listIndex].Id == account.Id) break; } Assert.IsTrue(list[listIndex] is BankAccountDTO); BankAccountIbanDTO castedBankAccount = this.Api.Users.GetBankAccountIban(john.Id, list[listIndex].Id); Assert.IsTrue(account.Id == castedBankAccount.Id); AssertEqualInputProps(account, castedBankAccount); Assert.IsTrue(pagination.Page == 1); Assert.IsTrue(pagination.ItemsPerPage == 12); // test sorting ListPaginated<BankAccountDTO> result = null; ListPaginated<BankAccountDTO> result2 = null; BankAccountOtherPostDTO account2 = new BankAccountOtherPostDTO(john.FirstName + " " + john.LastName, john.Address, "234234234234", "BINAADADXXX"); account2.Type = BankAccountType.OTHER; account2.Country = CountryIso.FR; this.Api.Users.CreateBankAccountOther(john.Id, account2); pagination = new Pagination(1, 2); Sort sort = new Sort(); sort.AddField("CreationDate", SortDirection.asc); result = this.Api.Users.GetBankAccounts(john.Id, pagination, sort); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); sort = new Sort(); sort.AddField("CreationDate", SortDirection.desc); result2 = this.Api.Users.GetBankAccounts(john.Id, pagination, sort); Assert.IsNotNull(result2); Assert.IsTrue(result2.Count > 0); Assert.IsTrue(result[0].Id != result2[0].Id); } catch (Exception ex) { Assert.Fail(ex.Message); } }
/// <summary>Creates OTHER bank account.</summary> /// <param name="userId">User identifier.</param> /// <param name="bankAccount">Bank account instance to be created.</param> /// <returns>Bank account instance returned from API.</returns> public BankAccountOtherDTO CreateBankAccountOther(String userId, BankAccountOtherPostDTO bankAccount) { return this.CreateObject<BankAccountOtherDTO, BankAccountOtherPostDTO>(MethodKey.UsersCreateBankAccountsOther, bankAccount, userId); }
public void Test_Users_CreateBankAccount_OTHER() { try { UserNaturalDTO john = this.GetJohn(); BankAccountOtherPostDTO account = new BankAccountOtherPostDTO(john.FirstName + " " + john.LastName, john.Address, "234234234234", "BINAADADXXX"); account.Type = BankAccountType.OTHER; account.Country = CountryIso.FR; BankAccountDTO createAccount = this.Api.Users.CreateBankAccountOther(john.Id, account); Assert.IsTrue(createAccount.Id.Length > 0); Assert.IsTrue(createAccount.UserId == (john.Id)); Assert.IsTrue(createAccount.Type == BankAccountType.OTHER); Assert.IsTrue(((BankAccountOtherDTO)createAccount).Type == BankAccountType.OTHER); Assert.IsTrue(((BankAccountOtherDTO)createAccount).Country == CountryIso.FR); Assert.IsTrue(((BankAccountOtherDTO)createAccount).AccountNumber == ("234234234234")); Assert.IsTrue(((BankAccountOtherDTO)createAccount).BIC == ("BINAADADXXX")); } catch (Exception ex) { Assert.Fail(ex.Message); } }