Exemplo n.º 1
0
        public void TwoAccountNumbers_WithSameValue_AreEqual()
        {
            var lhs = new AccountNumber(0, 19, "0100");
            var rhs = new AccountNumber(0, 19, "0100");

            Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode());
            Assert.True(lhs.Equals((object)rhs));
            Assert.True(lhs.Equals(rhs));
            Assert.True(lhs == rhs);
            Assert.False(lhs != rhs);
        }
Exemplo n.º 2
0
 protected override void Validate()
 {
     if (AccountNumber.Equals(""))
     {
         AddBrokenRule(AccountBusinessRule.AccountNameRequired);
     }
 }
Exemplo n.º 3
0
 protected override void Validate()
 {
     if (AccountNumber.Equals(""))
     {
         AddBrokenRule(GeneralLedgerBusinessRule.AccountNumberRequired);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns true if BankingInternationalPayeeBankDetails instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingInternationalPayeeBankDetails to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingInternationalPayeeBankDetails other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Country == other.Country ||
                     Country != null &&
                     Country.Equals(other.Country)
                     ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     BankAddress == other.BankAddress ||
                     BankAddress != null &&
                     BankAddress.Equals(other.BankAddress)
                 ) &&
                 (
                     BeneficiaryBankBIC == other.BeneficiaryBankBIC ||
                     BeneficiaryBankBIC != null &&
                     BeneficiaryBankBIC.Equals(other.BeneficiaryBankBIC)
                 ) &&
                 (
                     FedWireNumber == other.FedWireNumber ||
                     FedWireNumber != null &&
                     FedWireNumber.Equals(other.FedWireNumber)
                 ) &&
                 (
                     SortCode == other.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(other.SortCode)
                 ) &&
                 (
                     ChipNumber == other.ChipNumber ||
                     ChipNumber != null &&
                     ChipNumber.Equals(other.ChipNumber)
                 ) &&
                 (
                     RoutingNumber == other.RoutingNumber ||
                     RoutingNumber != null &&
                     RoutingNumber.Equals(other.RoutingNumber)
                 ) &&
                 (
                     LegalEntityIdentifier == other.LegalEntityIdentifier ||
                     LegalEntityIdentifier != null &&
                     LegalEntityIdentifier.Equals(other.LegalEntityIdentifier)
                 ));
        }
Exemplo n.º 5
0
 public override bool Equals(object obj)
 {
     if (null == obj)
     {
         return(false);
     }
     if (obj.GetType() != GetType())
     {
         return(false);
     }
     return(AccountNumber.Equals(((Account)obj).AccountNumber));
 }
Exemplo n.º 6
0
        /// <summary>
        /// Current Account transaction. Deposits a specified amount into the savings account and saves the changes in the database.
        /// Requires: The amount to be deposited should not be negative
        /// Requires: The account number is valid
        /// </summary>
        /// <param name="amount">the amount to deposit</param>
        /// <param name="Accountnumber">Number identifying account.</param>
        /// <exception cref="ArgumentException"> Thrown when a negative amount deposit is attempted or,
        /// when the input account number is not same as
        /// the account number registered for the account.</exception>
        /// <returns>The new account balance</returns>
        public override double makeDeposit(string Accountnumber, double amount)
        {
            Contract.Requires <ArgumentException>(amount > 0, "Invalid amount. Please check input");

            Contract.Requires <ArgumentException>(AccountNumber.Equals(Accountnumber), "Invalid account number, check again");
            Contract.Ensures(Contract.OldValue <double>(AccountBalance) < AccountBalance);
            Contract.Ensures((Contract.OldValue <double>(AccountBalance) + amount).Equals(AccountBalance));
            AccountBalance = AccountBalance + amount;

            // Credit the account in the database
            BankDatabaseEngine.CreditAccount(Accountnumber, amount);

            return(AccountBalance);
        }//end makeDeposit method
Exemplo n.º 7
0
        /// <summary>
        ///     Returns true if AccountDetailsViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of AccountDetailsViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountDetailsViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     BankId == other.BankId ||
                     BankId != null &&
                     BankId.Equals(other.BankId)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     SortCode == other.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(other.SortCode)
                 ) &&
                 (
                     AccountName == other.AccountName ||
                     AccountName != null &&
                     AccountName.Equals(other.AccountName)
                 ) &&
                 (
                     CurrentBalance == other.CurrentBalance ||
                     CurrentBalance != null &&
                     CurrentBalance.Equals(other.CurrentBalance)
                 ) &&
                 (
                     OverdraftLimit == other.OverdraftLimit ||
                     OverdraftLimit != null &&
                     OverdraftLimit.Equals(other.OverdraftLimit)
                 ));
        }
Exemplo n.º 8
0
        }//end makeDeposit method

        /// <summary>
        /// Current Account transaction. Withdraws a specified amount from the current account and saves the changes in the database.
        /// Requires: The amount to be withdrawn should not be negative
        /// Requires: The amount to be withdrawn should be less than or equal to the account balance
        /// Requires: The account balance should be more than the minimum balance allowed for the bank
        /// Requires: The account number is valid
        /// </summary>
        /// <param name="Accountnumber">Number identifying account</param>
        /// <param name="amount">the amount to withdraw</param>
        /// <exception cref="ArgumentException">Thrown when the account balance is not sufficient for the transaction or,
        /// when the amount to withdraw is negative or,
        /// when the input account number is not same as
        /// the account number registered for the account.</exception>
        /// <returns>The new account balance</returns>
        public override double makeWithdrawal(string Accountnumber, double amount)
        {
            Contract.Requires <ArgumentException>(amount > 0, "Invalid amount. Please check input");
            Contract.Requires <ArgumentException>(amount <= (AccountBalance - BankPolicy.minimumcurrentBalance), "Cannot withdraw more than the available balance");
            Contract.Requires <ArgumentException>(AccountBalance >= BankPolicy.minimumcurrentBalance, "Account balance is Insufficient for this transaction");
            Contract.Requires <ArgumentException>(AccountNumber.Equals(Accountnumber), "Invalid account number, check again");
            Contract.Ensures(AccountBalance >= BankPolicy.minimumcurrentBalance);
            Contract.Ensures(Contract.OldValue <double>(AccountBalance) > AccountBalance);
            Contract.Ensures((Contract.OldValue <double>(AccountBalance) - amount).Equals(AccountBalance));

            AccountBalance = AccountBalance - amount;

            // Debit the account in the database
            BankDatabaseEngine.DebitAccount(Accountnumber, amount);

            return(AccountBalance);
        }//end makeWithdrawal method
        /// <summary>
        /// Returns true if BankAccountBban instances are equal
        /// </summary>
        /// <param name="other">Instance of BankAccountBban to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankAccountBban other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                     ) &&
                 (
                     BankCode == other.BankCode ||
                     BankCode != null &&
                     BankCode.Equals(other.BankCode)
                 ) &&
                 (
                     BankName == other.BankName ||
                     BankName != null &&
                     BankName.Equals(other.BankName)
                 ) &&
                 (
                     BranchCode == other.BranchCode ||
                     BranchCode != null &&
                     BranchCode.Equals(other.BranchCode)
                 ) &&
                 (
                     CheckDigit == other.CheckDigit ||
                     CheckDigit != null &&
                     CheckDigit.Equals(other.CheckDigit)
                 ) &&
                 (
                     CountryCode == other.CountryCode ||
                     CountryCode != null &&
                     CountryCode.Equals(other.CountryCode)
                 ));
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Returns true if AccountIdentifierViewModel instances are equal
        /// </summary>
        /// <param name="input">Instance of AccountIdentifierViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountIdentifierViewModel input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AccountNumber == input.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(input.AccountNumber)
                     ) &&
                 (
                     SortCode == input.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(input.SortCode)
                 ));
        }
Exemplo n.º 11
0
        /// <summary>
        ///     Returns true if AccountViewModel instances are equal
        /// </summary>
        /// <param name="input">Instance of AccountViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountViewModel input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AccountName == input.AccountName ||
                     AccountName != null &&
                     AccountName.Equals(input.AccountName)
                     ) &&
                 (
                     AccountNumber == input.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(input.AccountNumber)
                 ) &&
                 (
                     SortCode == input.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(input.SortCode)
                 ) &&
                 (
                     Balance == input.Balance ||
                     Balance != null &&
                     Balance.Equals(input.Balance)
                 ) &&
                 (
                     AvailableBalance == input.AvailableBalance ||
                     AvailableBalance != null &&
                     AvailableBalance.Equals(input.AvailableBalance)
                 ) &&
                 (
                     Overdraft == input.Overdraft ||
                     Overdraft != null &&
                     Overdraft.Equals(input.Overdraft)
                 ));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Returns true if BankInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of BankInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                     ) &&
                 (
                     CurrencyId == other.CurrencyId ||
                     CurrencyId != null &&
                     CurrencyId.Equals(other.CurrencyId)
                 ) &&
                 (
                     AccountHolder == other.AccountHolder ||
                     AccountHolder != null &&
                     AccountHolder.Equals(other.AccountHolder)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     Iban == other.Iban ||
                     Iban != null &&
                     Iban.Equals(other.Iban)
                 ) &&
                 (
                     BankName == other.BankName ||
                     BankName != null &&
                     BankName.Equals(other.BankName)
                 ) &&
                 (
                     SortCode == other.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(other.SortCode)
                 ) &&
                 (
                     RoutingNumber == other.RoutingNumber ||
                     RoutingNumber != null &&
                     RoutingNumber.Equals(other.RoutingNumber)
                 ) &&
                 (
                     SwiftBic == other.SwiftBic ||
                     SwiftBic != null &&
                     SwiftBic.Equals(other.SwiftBic)
                 ) &&
                 (
                     IfscCode == other.IfscCode ||
                     IfscCode != null &&
                     IfscCode.Equals(other.IfscCode)
                 ) &&
                 (
                     RoutingCode == other.RoutingCode ||
                     RoutingCode != null &&
                     RoutingCode.Equals(other.RoutingCode)
                 ) &&
                 (
                     UserAddressId == other.UserAddressId ||
                     UserAddressId != null &&
                     UserAddressId.Equals(other.UserAddressId)
                 ) &&
                 (
                     BankAddress == other.BankAddress ||
                     BankAddress != null &&
                     BankAddress.Equals(other.BankAddress)
                 ));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Returns true if OutputAddressValidationInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputAddressValidationInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputAddressValidationInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     IsValid == other.IsValid ||
                     IsValid != null &&
                     IsValid.Equals(other.IsValid)
                     ) &&
                 (
                     IsAccount == other.IsAccount ||
                     IsAccount != null &&
                     IsAccount.Equals(other.IsAccount)
                 ) &&
                 (
                     IsBlacklisted == other.IsBlacklisted ||
                     IsBlacklisted != null &&
                     IsBlacklisted.Equals(other.IsBlacklisted)
                 ) &&
                 (
                     Avatar == other.Avatar ||
                     Avatar != null &&
                     Avatar.Equals(other.Avatar)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     CorrectAddress == other.CorrectAddress ||
                     CorrectAddress != null &&
                     CorrectAddress.Equals(other.CorrectAddress)
                 ) &&
                 (
                     MemoExpected == other.MemoExpected ||
                     MemoExpected != null &&
                     MemoExpected.Equals(other.MemoExpected)
                 ) &&
                 (
                     MemoPlaceholderText == other.MemoPlaceholderText ||
                     MemoPlaceholderText != null &&
                     MemoPlaceholderText.Equals(other.MemoPlaceholderText)
                 ) &&
                 (
                     SimilarToExistingService == other.SimilarToExistingService ||
                     SimilarToExistingService != null &&
                     SimilarToExistingService.Equals(other.SimilarToExistingService)
                 ) &&
                 (
                     Balances == other.Balances ||
                     Balances != null &&
                     Balances.Equals(other.Balances)
                 ));
        }
Exemplo n.º 14
0
#pragma warning restore CS1591                                 // Missing XML comment for publicly visible type or member 'bankAccount.CanBeBlocked'

#pragma warning disable CS1591                                 // Missing XML comment for publicly visible type or member 'bankAccount.Equals(bankAccount)'
        public bool Equals(bankAccount other)
#pragma warning restore CS1591                                 // Missing XML comment for publicly visible type or member 'bankAccount.Equals(bankAccount)'
        {
            return(AccountNumber.Equals(other.AccountNumber)); //GetUID().Equals(other.GetUID());
        }
 public bool Equals(AbstractAccount <TClientKey, TTransaction, TAccountKey, TTransactionKey> other)
 {
     return(AccountNumber.Equals(other.AccountNumber));
 }
Exemplo n.º 16
0
 public bool Equals(IAccount <TAccountKey, TTransactionKey> other)
 {
     return(AccountNumber.Equals(other.AccountNumber));
 }
        /// <summary>
        /// Returns true if BankingAccountDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingAccountDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingAccountDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Bsb == other.Bsb ||
                     Bsb != null &&
                     Bsb.Equals(other.Bsb)
                     ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     BundleName == other.BundleName ||
                     BundleName != null &&
                     BundleName.Equals(other.BundleName)
                 ) &&
                 (
                     SpecificAccountUType == other.SpecificAccountUType ||
                     SpecificAccountUType != null &&
                     SpecificAccountUType.Equals(other.SpecificAccountUType)
                 ) &&
                 (
                     TermDeposit == other.TermDeposit ||
                     TermDeposit != null &&
                     TermDeposit.Equals(other.TermDeposit)
                 ) &&
                 (
                     CreditCard == other.CreditCard ||
                     CreditCard != null &&
                     CreditCard.Equals(other.CreditCard)
                 ) &&
                 (
                     Loan == other.Loan ||
                     Loan != null &&
                     Loan.Equals(other.Loan)
                 ) &&
                 (
                     Features == other.Features ||
                     Features != null &&
                     Features.SequenceEqual(other.Features)
                 ) &&
                 (
                     Fees == other.Fees ||
                     Fees != null &&
                     Fees.SequenceEqual(other.Fees)
                 ) &&
                 (
                     DepositRates == other.DepositRates ||
                     DepositRates != null &&
                     DepositRates.SequenceEqual(other.DepositRates)
                 ) &&
                 (
                     LendingRates == other.LendingRates ||
                     LendingRates != null &&
                     LendingRates.SequenceEqual(other.LendingRates)
                 ) &&
                 (
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                 ));
        }