Exemplo n.º 1
0
        public void Transfer_NullFromAccount_Throws()
        {
            var  toAccount  = new Account(ToAccountNumber, 53.75);
            bool transferOk = false;

            Assert.Throws <BankTransferService.TransferException>(() => transferOk = BankTransferService.Transfer(null, toAccount, 24.13));
        }
Exemplo n.º 2
0
        public void Transfer_OverdrawFromPositiveAccount_FromAccountChargedFeeRoundsUp()
        {
            var  fromAccount = new Account(FromAccountNumber, 0.50);
            var  toAccount   = new Account(ToAccountNumber, 0.0);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 0.90);

            AssertEqual(-0.41, fromAccount.Balance);
        }
Exemplo n.º 3
0
        public void Transfer_OverdrawFromPositiveAccount_AllowedReturnsTrue()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 77.89);

            Assert.True(transferOk);
        }
Exemplo n.º 4
0
        public void Transfer_ValidAccountsSufficientBalance_ToAccountIsIncreased()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 24.13);

            AssertEqual(77.88, toAccount.Balance);
        }
Exemplo n.º 5
0
        public void Transfer_ValidAccountsSufficientBalance_ReturnsTrue()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 24.13);

            Assert.True(transferOk);
        }
Exemplo n.º 6
0
        public void Transfer_NegativeTransfer_NotAllowed()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, -77.88);

            Assert.False(transferOk);
        }
Exemplo n.º 7
0
        public void Transfer_OverdrawFromEmptyAccount_Allowed()
        {
            var  fromAccount = new Account(FromAccountNumber, 0.0);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 77.89);

            Assert.True(transferOk);
        }
Exemplo n.º 8
0
        public void Transfer_OverdrawFromOverdrawnAccount_NotAllowedReturnsFalse()
        {
            var  fromAccount = new Account(FromAccountNumber, -0.01);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 77.89);

            Assert.False(transferOk);
        }
Exemplo n.º 9
0
        public void Transfer_OverdrawFromPositiveAccount_ToAccountCredited()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 77.89);

            AssertEqual(131.64, toAccount.Balance);
        }
Exemplo n.º 10
0
        public void Transfer_TransferEntireAccountBalance_Allowed()
        {
            var  fromAccount = new Account(FromAccountNumber, 77.88);
            var  toAccount   = new Account(ToAccountNumber, 53.75);
            bool transferOk  = false;

            transferOk = BankTransferService.Transfer(fromAccount, toAccount, 77.88);

            Assert.True(transferOk);
            AssertEqual(0.0, fromAccount.Balance);
        }