public void SetHost(List <AccountAllocation> listHost, BankAccountDTO bankAccount, ISimpleRepo <GLAccountDTO> glAcctsRepo) { _list = listHost; _bank = bankAccount; //todo: use .IncludeCashInBanks() _glAccts = glAcctsRepo?.GetAll(); _glAccts?.Insert(0, GLAccountDTO.CashInBank(_bank)); UpdateUILists(); }
public void HasItemamountchangedupdatesitem() { var sut = new AllocationsListVM(); var bank = BankAccountDTO.Named("test bank acct"); var item = new AccountAllocation { Account = GLAccountDTO.CashInBank(bank), SubAmount = 123 }; var host = new List <AccountAllocation> { item }; var amt = 456; sut.SetHost(host, bank, null); sut.OnAmountChanged(amt); sut.Should().HaveCount(1); sut[0].Account.Name.Should().Contain("Cash in Bank"); sut[0].Account.Name.Should().Contain(bank.Name); sut[0].SubAmount.Should().Be(amt); }
public static AccountAllocation DefaultCashInBank(BankAccountDTO bankAccount, decimal amount) => NewCredit(GLAccountDTO.CashInBank(bankAccount), amount);