public void GetAccountsNoFilter() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.Accounts.Count, 0, "Zero accounts returned"); }
public void GetAccountsFilterOnIsNotBankAccount() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(isBankAccount: false); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.Accounts.Count, 0, "Zero accounts returned"); response.DataObject.Accounts.ForEach(a => Assert.IsFalse(Convert.ToBoolean(a.IsBankAccount), "Bank accounts have been returned")); }
public void GetAccountsSecondPage() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(pageNumber: 1, pageSize: 10); Assert.IsNotNull(response, "Reponse is null"); Assert.AreEqual(response.DataObject.Accounts.Count, 10, "10 records should have been returned"); var acctIdsFirstPage = response.DataObject.Accounts.Select(a => a.Id).ToList(); response = accountsProxy.GetAccounts(pageNumber: 2, pageSize: 10); Assert.IsNotNull(response, "Reponse is null"); Assert.Greater(response.DataObject.Accounts.Count, 0, "Zero accounts returned"); response.DataObject.Accounts.ForEach(a => Assert.IsFalse(acctIdsFirstPage.Contains(a.Id), "Record from page 1 returned")); }
public void GetAccountsPageSize() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(pageSize: 10); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.AreEqual(response.DataObject.Accounts.Count, 10, "10 records should have been returned"); }
public void GetAccountsFilterOnHeaderAccountId() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(headerAccountId: _headerAccountId); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.AreEqual(response.DataObject.Accounts.Count, 1, "Incorrect number of accounts returned"); Assert.AreEqual(response.DataObject.Accounts[0].Id, _accountToAssignToHeaderAccount, "Incorrect account assigned to header account."); }
public void GetAccountsFilterOnAccountType() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(accountType: "Income"); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.Accounts.Count, 0, "Zero accounts returned"); response.DataObject.Accounts.ForEach(a => Assert.AreEqual(a.AccountType, "Income")); }
public void GetAccountsFilterOnNotIncludeBuiltIn() { var accountsProxy = new AccountsProxy(); var response = accountsProxy.GetAccounts(includeBuiltIn: false); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.Accounts.Count, 0, "Zero accounts returned"); var builtInAccounts = response.DataObject.Accounts.Where(a => Convert.ToBoolean(a.IsBuiltIn)); Assert.AreEqual(builtInAccounts.Count(), 0); }
private static int GetAccount(string accountType) { var accountsProxy = new AccountsProxy(); var accountsResponse = accountsProxy.GetAccounts(isActive: true, accountType: accountType); if (accountsResponse.DataObject.Accounts.Count == 0) { var account = new AccountDetail { Name = string.Format("TestAccount_{0}", Guid.NewGuid()), AccountType = "Asset", IsActive = true, DefaultTaxCode = "G1", LedgerCode = "AA", Currency = "AUD", IsBankAccount = false }; var accountProxy = new AccountProxy(); var accountResponse = accountProxy.InsertAccount(account); if (accountResponse.IsSuccessfull) _inventoryAccountId = accountResponse.DataObject.InsertedEntityId; return _inventoryAccountId; } else { return accountsResponse.DataObject.Accounts.First().Id.Value; } }