示例#1
0
        public void TransferMoney(AccountToTransfer accountToTransfer)
        {
            if (accountToTransfer?.AccountToTransferMoney is null) throw new ArgumentNullException(nameof(accountToTransfer));
            Guard.ThrowIfNotPositiveDecimal(accountToTransfer.MoneyToTransfer, "Debe ingresar un monto válido", nameof(accountToTransfer.MoneyToTransfer));

            Money = Money - accountToTransfer.MoneyToTransfer;
        }
示例#2
0
        //TODO: 03 - More exceptions
        public AccountToTransfer SearchTransfer(int transferId, DateTime date, AccountToTransfer account)
        {
            Guard.ThrowIfNull(date, "Debe ingresar una fecha", nameof(date));
            Guard.ThrowIfNull(account, "Debe ingresar una Cuenta", nameof(date));

            if (_transfers.All(x => x.TransferId != transferId))
                throw new AccountToTransferDoesNotExistException("La cuenta a la que intenta transferir no existe");

            return _transfers.First(x => x.TransferId == transferId);
        }
示例#3
0
        public void TransferMoney(AccountToTransfer accountToTransfer)
        {
            //TODO: 02 - Implemento transferencia.

            if (accountToTransfer is null)
            {
                throw new ArgumentNullException(nameof(accountToTransfer));
            }
            if (accountToTransfer.AccountToTransferMoney is null)
            {
                throw new ArgumentNullException(nameof(accountToTransfer));
            }
            Guard.ThrowIfNotPositiveDecimal(accountToTransfer.MoneyToTransfer, "Debe ingresar un monto válido", nameof(accountToTransfer.MoneyToTransfer));

            Money = Money - accountToTransfer.MoneyToTransfer;
        }