public void UpdateHeaderAccount() { //Create and Insert var account = GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); var accountId = response.DataObject.InsertedEntityId; //Get account again and verify inserted fields. var insertedAcctFromDb = accountProxy.GetAccount(accountId); var newName = string.Format("TestAccount_{0}", Guid.NewGuid()); account.Name = newName; account.LastUpdatedId = insertedAcctFromDb.DataObject.LastUpdatedId; var updateResponse = accountProxy.UpdateAccount(response.DataObject.InsertedEntityId, account); Assert.IsNotNull(updateResponse, "Reponse is null"); Assert.IsTrue(updateResponse.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify inserted fields. var updatedAcctFromDb = accountProxy.GetAccount(accountId); Assert.IsNotNull(updatedAcctFromDb, "Reponse is null"); Assert.IsTrue(updatedAcctFromDb.IsSuccessfull, "Reponse has not been successful"); Assert.AreEqual(updatedAcctFromDb.DataObject.Name, newName); }
public void UpdateBankAccountBankFileCreationNotEnabled() { var accountProxy = new AccountProxy(); //Get account, change fields then update. var acct = accountProxy.GetAccount(_bankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = false; acct.DataObject.BankCode = null; acct.DataObject.UserNumber = null; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAcctId); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, false, "BankFileCreationEnabled not equal"); //Bank code and user number should not have changed because BankFileCreationEnabled was false. Assert.IsNull(acct.DataObject.BankCode, "Bank code not null"); Assert.IsNull(acct.DataObject.UserNumber, "User number not null"); }
public void UpdateBankAccountBankFileCreationEnabled() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountHelper.BankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "AAA"; acct.DataObject.UserNumber = "222"; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountHelper.BankAcctId); Assert.NotNull(acct); Assert.Equal(newBankName, acct.DataObject.BankAccountName); Assert.Equal(true, acct.DataObject.BankFileCreationEnabled); Assert.Equal("AAA", acct.DataObject.BankCode); Assert.Equal("222", acct.DataObject.UserNumber); //Reset Bank Code and Customer Number for other tests. acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "TBA"; acct.DataObject.UserNumber = "111"; accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); }
public void UpdateBankAccountBankFileCreationEnabled() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_bankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "AAA"; acct.DataObject.UserNumber = "222"; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAcctId); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, true, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, "AAA", "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, "222", "User numbers not equal"); //Reset Bank Code and Customer Number for other tests. acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "TBA"; acct.DataObject.UserNumber = "111"; accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); }
public void UpdateBankAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_bankAccountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var newBankAccountName = string.Format("Update Bank Account_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = true, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = null, Currency = "AUD", LedgerCode = "BB", IncludeInForecaster = false, BSB = "020202", Number = "22222222", BankAccountName = newBankAccountName, BankFileCreationEnabled = true, BankCode = "B", UserNumber = "333", MerchantFeeAccountId = _bankAcctId, IncludePendingTransactions = false }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAccountToBeUpdated); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.Name, newName, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, "Equity", "Account types not equal"); Assert.AreEqual(acct.DataObject.IsActive, false, "IsAcive not equal"); Assert.IsNull(acct.DataObject.DefaultTaxCode, "Default should be null"); Assert.AreEqual(acct.DataObject.Currency, "AUD", "Currencies not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, "BB", "Ledger codes not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, false, "Include in Forecaster not equal"); Assert.AreEqual(acct.DataObject.BSB, "020202", "BSBs not equal"); Assert.AreEqual(acct.DataObject.Number, "22222222", "Account Numbers not equal"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankAccountName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, true, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, "B", "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, "333", "User numbers not equal"); Assert.AreEqual(acct.DataObject.MerchantFeeAccountId, _bankAcctId, "Merchant accounts not equal"); Assert.AreEqual(acct.DataObject.IncludePendingTransactions, false, "IncludePendingTransactions not equal"); }
public void UpdateBankAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountHelper.BankAccountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var newBankAccountName = string.Format("Update Bank Account_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = true, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = null, Currency = "AUD", LedgerCode = "BB", IncludeInForecaster = false, BSB = "020202", Number = "22222222", BankAccountName = newBankAccountName, BankFileCreationEnabled = true, BankCode = "B", UserNumber = "333", MerchantFeeAccountId = _accountHelper.BankAcctId, IncludePendingTransactions = false }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountHelper.BankAccountToBeUpdated); Assert.NotNull(acct); Assert.Equal(newName, acct.DataObject.Name); Assert.Equal("Equity", acct.DataObject.AccountType); Assert.Equal(false, acct.DataObject.IsActive); Assert.Null(acct.DataObject.DefaultTaxCode); Assert.Equal("AUD", acct.DataObject.Currency); Assert.Equal("BB", acct.DataObject.LedgerCode); Assert.Equal(false, acct.DataObject.IncludeInForecaster); Assert.Equal("020202", acct.DataObject.BSB); Assert.Equal("22222222", acct.DataObject.Number); Assert.Equal(newBankAccountName, acct.DataObject.BankAccountName); Assert.Equal(true, acct.DataObject.BankFileCreationEnabled); Assert.Equal("B", acct.DataObject.BankCode); Assert.Equal("333", acct.DataObject.UserNumber); Assert.Equal(_accountHelper.BankAcctId, acct.DataObject.MerchantFeeAccountId); Assert.Equal(false, acct.DataObject.IncludePendingTransactions); }
public void InsertAccountWithHeader() { //Create and Insert var headerAccount = GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var headerInsertResponse = accountProxy.InsertAccount(headerAccount); Assert.IsNotNull(headerInsertResponse, "Reponse is null"); Assert.IsTrue(headerInsertResponse.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(headerInsertResponse.DataObject.InsertedEntityId, 0, "Zero accounts returned"); var headerAccountId = headerInsertResponse.DataObject.InsertedEntityId; var account = GetTestAccount(); account.HeaderAccountId = headerAccountId; var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.AreEqual(acct.DataObject.Name, account.Name, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, account.AccountType, "Account types not equal"); Assert.AreEqual(acct.DataObject.DefaultTaxCode, account.DefaultTaxCode, "Tax codes not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, account.LedgerCode, "Leadge codes not equal"); Assert.AreEqual(acct.DataObject.Currency, account.Currency, "Currencies not equal"); Assert.AreEqual(acct.DataObject.IsBankAccount, account.IsBankAccount, "IsBankAccount not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, false, "IncludeInForecaster should be false for non bank accounts"); Assert.AreEqual(acct.DataObject.HeaderAccountId, headerAccountId); }
public void InsertBankAccount() { //Create and Insert var account = GetTestBankAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.AreEqual(acct.DataObject.Name, account.Name, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, account.AccountType, "Account types not equal"); Assert.AreEqual(acct.DataObject.DefaultTaxCode, account.DefaultTaxCode, "Tax codes not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, account.LedgerCode, "Ledger codes not equal"); Assert.AreEqual(acct.DataObject.Currency, account.Currency, "Currencis not equal"); Assert.AreEqual(acct.DataObject.IsBankAccount, account.IsBankAccount, "IsBankAccount not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, account.IncludeInForecaster, "Include in Forecaster not equal"); Assert.AreEqual(acct.DataObject.BSB, account.BSB, "BSBs not equal"); Assert.AreEqual(acct.DataObject.Number, account.Number, "Account numbers not equal"); Assert.AreEqual(acct.DataObject.BankAccountName, account.BankAccountName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, account.BankFileCreationEnabled, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, account.BankCode, "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, account.UserNumber, "User numbers not equal"); Assert.AreEqual(acct.DataObject.MerchantFeeAccountId, account.MerchantFeeAccountId, "Merchant accounts not equal"); Assert.AreEqual(acct.DataObject.IncludePendingTransactions, account.IncludePendingTransactions, "IncludePendingTransactions not equal"); }
public void InsertAccountWithHeader() { //Create and Insert var headerAccount = _accountHelper.GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var headerInsertResponse = accountProxy.InsertAccount(headerAccount); Assert.NotNull(headerInsertResponse); Assert.True(headerInsertResponse.IsSuccessfull, "Reponse has not been successful"); Assert.True(headerInsertResponse.DataObject.InsertedEntityId > 0, "Zero accounts returned"); var headerAccountId = headerInsertResponse.DataObject.InsertedEntityId; var account = _accountHelper.GetTestAccount(); account.HeaderAccountId = headerAccountId; var response = accountProxy.InsertAccount(account); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.True(response.DataObject.InsertedEntityId > 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.Equal(account.Name, acct.DataObject.Name); Assert.Equal(account.AccountType, acct.DataObject.AccountType); Assert.Equal(account.DefaultTaxCode, acct.DataObject.DefaultTaxCode); Assert.Equal(account.LedgerCode, acct.DataObject.LedgerCode); Assert.Equal(account.Currency, acct.DataObject.Currency); Assert.Equal(account.IsBankAccount, acct.DataObject.IsBankAccount); Assert.Equal(false, acct.DataObject.IncludeInForecaster); Assert.Equal(headerAccountId, acct.DataObject.HeaderAccountId); }
public void InsertBankAccount() { //Create and Insert var account = _accountHelper.GetTestBankAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.True(response.DataObject.InsertedEntityId > 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.Equal(account.Name, acct.DataObject.Name); Assert.Equal(account.AccountType, acct.DataObject.AccountType); Assert.Equal(account.DefaultTaxCode, acct.DataObject.DefaultTaxCode); Assert.Equal(account.LedgerCode, acct.DataObject.LedgerCode); Assert.Equal(account.Currency, acct.DataObject.Currency); Assert.Equal(account.IsBankAccount, acct.DataObject.IsBankAccount); Assert.Equal(account.IncludeInForecaster, acct.DataObject.IncludeInForecaster); Assert.Equal(account.BSB, acct.DataObject.BSB); Assert.Equal(account.Number, acct.DataObject.Number); Assert.Equal(account.BankAccountName, acct.DataObject.BankAccountName); Assert.Equal(account.BankFileCreationEnabled, acct.DataObject.BankFileCreationEnabled); Assert.Equal(account.BankCode, acct.DataObject.BankCode); Assert.Equal(account.UserNumber, acct.DataObject.UserNumber); Assert.Equal(account.MerchantFeeAccountId, acct.DataObject.MerchantFeeAccountId); Assert.Equal(account.IncludePendingTransactions, acct.DataObject.IncludePendingTransactions); }
public void GetBankAccount() { var accountsProxy = new AccountProxy(); var response = accountsProxy.GetAccount(_bankAcctId); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.IsTrue(Convert.ToBoolean(response.DataObject.IsBankAccount), "Account returned is not a bank account"); }
public void GetNonBankAccount() { var accountsProxy = new AccountProxy(); var response = accountsProxy.GetAccount(_accountHelper.NonBankAcctId); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.False(Convert.ToBoolean(response.DataObject.IsBankAccount), "Account returned is a bank account"); }
public void UpdateAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = false, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = "G1,G4", Currency = "AUD", LedgerCode = "BB" }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountToBeUpdated); Assert.IsNotNull(acct, "Account is null"); Assert.AreEqual(acct.DataObject.Name, newName, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, "Equity", "Account types not equal"); Assert.AreEqual(acct.DataObject.IsActive, false, "IsActive not equal"); Assert.AreEqual(acct.DataObject.DefaultTaxCode, "G1,G4", "Default tax codes not equal"); Assert.AreEqual(acct.DataObject.Currency, "AUD", "Currencies not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, "BB", "Ledger codes not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, false, "Include in Forecaster should be false for non bank accounts"); }
public void UpdateAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountHelper.AccountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = false, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = "G1,G4", Currency = "AUD", LedgerCode = "BB" }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountHelper.AccountToBeUpdated); Assert.NotNull(acct); Assert.Equal(newName, acct.DataObject.Name); Assert.Equal("Equity", acct.DataObject.AccountType); Assert.Equal(false, acct.DataObject.IsActive); Assert.Equal("G1,G4", acct.DataObject.DefaultTaxCode); Assert.Equal("AUD", acct.DataObject.Currency); Assert.Equal("BB", acct.DataObject.LedgerCode); Assert.Equal(false, acct.DataObject.IncludeInForecaster); }
public void InsertHeaderAccount() { //Create and Insert var account = GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.AreEqual(acct.DataObject.Name, account.Name, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountLevel.ToLower(), "header"); Assert.AreEqual(acct.DataObject.AccountType, account.AccountType, "Account types not equal"); Assert.IsNull(acct.DataObject.DefaultTaxCode, "Tax code should be null"); Assert.AreEqual(acct.DataObject.LedgerCode, account.LedgerCode, "Ledger codes not equal"); Assert.IsFalse(Convert.ToBoolean(acct.DataObject.IsBankAccount), "Header accounts cannot be bank accounts"); Assert.IsFalse(Convert.ToBoolean(acct.DataObject.IncludeInForecaster), "Header accounts cannot be included in forecaster"); }
public void InsertHeaderAccount() { //Create and Insert var account = _accountHelper.GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.True(response.DataObject.InsertedEntityId > 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.Equal(account.Name, acct.DataObject.Name); Assert.Equal("header", acct.DataObject.AccountLevel.ToLower()); Assert.Equal(account.AccountType, acct.DataObject.AccountType); Assert.Null(acct.DataObject.DefaultTaxCode); Assert.Equal(account.LedgerCode, acct.DataObject.LedgerCode); Assert.False(Convert.ToBoolean(acct.DataObject.IsBankAccount), "Header accounts cannot be bank accounts"); Assert.False(Convert.ToBoolean(acct.DataObject.IncludeInForecaster), "Header accounts cannot be included in forecaster"); }