Beispiel #1
0
        public async Task Test_Users_UpdateBankAccount()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                BankAccountIbanDTO account = await this.GetJohnsAccount();

                Assert.IsTrue(account.Id.Length > 0);
                Assert.IsTrue(account.UserId == (john.Id));
                Assert.IsTrue(account.Active);

                // disactivate bank account
                DisactivateBankAccountPutDTO disactivateBankAccount = new DisactivateBankAccountPutDTO();
                disactivateBankAccount.Active = false;

                BankAccountDTO result = await this.Api.Users.UpdateBankAccount(john.Id, disactivateBankAccount, account.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(account.Id == result.Id);
                Assert.IsFalse(result.Active);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_UpdateBankAccount()
        {
            try
            {
                UserNaturalDTO     john    = TestHelper.GetJohn();
                BankAccountIbanDTO account = TestHelper.GetJohnsAccount();

                Assert.True(account.Id.Length > 0);
                Assert.True(account.UserId == (john.Id));
                Assert.True(account.Active);

                // disactivate bank account
                DisactivateBankAccountPutDTO disactivateBankAccount = new DisactivateBankAccountPutDTO();
                disactivateBankAccount.Active = false;

                BankAccountDTO result = _objectToTest.UpdateBankAccount(john.Id, disactivateBankAccount, account.Id).Result;

                Assert.NotNull(result);
                Assert.True(account.Id == result.Id);
                Assert.False(result.Active);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
        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);
            }
        }
Beispiel #4
0
 protected BankAccountIbanDTO GetJohnsAccount()
 {
     if (BaseTest._johnsAccount == null)
     {
         UserNaturalDTO         john    = this.GetJohn();
         BankAccountIbanPostDTO account = new BankAccountIbanPostDTO(john.FirstName + " " + john.LastName, john.Address, "FR76 1790 6000 3200 0833 5232 973");
         account.UserId         = john.Id;
         account.BIC            = "BINAADADXXX";
         BaseTest._johnsAccount = this.Api.Users.CreateBankAccountIban(john.Id, account);
     }
     return(BaseTest._johnsAccount);
 }
Beispiel #5
0
 protected BankAccountIbanDTO GetJohnsAccount(bool recreate = false)
 {
     if (BaseTest._johnsAccount == null || recreate)
     {
         UserNaturalDTO         john    = this.GetJohn();
         BankAccountIbanPostDTO account = new BankAccountIbanPostDTO(john.FirstName + " " + john.LastName, john.Address, "FR7618829754160173622224154");
         account.UserId         = john.Id;
         account.BIC            = "CMBRFR2BCME";
         BaseTest._johnsAccount = this.Api.Users.CreateBankAccountIban(john.Id, account);
     }
     return(BaseTest._johnsAccount);
 }
        public void Test_Users_CreateBankAccount()
        {
            try
            {
                UserNaturalDTO     john    = this.GetJohn();
                BankAccountIbanDTO account = this.GetJohnsAccount();

                Assert.IsTrue(account.Id.Length > 0);
                Assert.IsTrue(account.UserId == (john.Id));
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_BankAccount()
        {
            try
            {
                UserNaturalDTO     john    = this.GetJohn();
                BankAccountIbanDTO account = this.GetJohnsAccount();

                BankAccountIbanDTO accountFetched = this.Api.Users.GetBankAccountIban(john.Id, account.Id);

                AssertEqualInputProps(account, accountFetched);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_BankAccount()
        {
            try
            {
                UserNaturalDTO     john    = TestHelper.GetJohn();
                BankAccountIbanDTO account = TestHelper.GetJohnsAccount();

                BankAccountIbanDTO accountFetched = _objectToTest.GetBankAccountIban(john.Id, account.Id).Result;

                TestHelper.AssertEqualInputProps(account, accountFetched);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }