Exemplo n.º 1
0
        public void TransferFunds()
        {
            source.TransferFunds(destination, 100m);

            Assert.AreEqual(250m, destination.Balance);
            Assert.AreEqual(100m, source.Balance);
        }
        public decimal PayBill(string billCode, Account payer, decimal payment)
        {
            payer.TransferFunds(utilitiesAccount, payment);
            this.bills[billCode] -= payment;

            return this.bills[billCode];
        }
        public static int Main()
        {
            Account x = new Account(100);
            Account y = new Account(50);
            y.Deposit(50);
            x.TransferFunds(y, 25);

            return 0;
        }
Exemplo n.º 4
0
        public void TransferFunds()
        {
            //act
            source.TransferFunds(destination, 100.00f);

            //Assert
            Assert.AreEqual(250.00f, destination.Balance);
            Assert.AreEqual(100.00f, source.Balance);
        }
Exemplo n.º 5
0
        public void TransferWithInsufficientFunds()
        {
            Account source = new Account();

            source.Deposit(200m);

            Account destination = new Account();

            destination.Deposit(150m);

            source.TransferFunds(destination, 300m);
        }
Exemplo n.º 6
0
        public void TransferFunds()
        {
            Account source = new Account();

            source.Deposit(200m);

            Account destination = new Account();

            destination.Deposit(150m);

            source.TransferFunds(destination, 100m);

            Assert.AreEqual(250m, destination.Balance);
            Assert.AreEqual(100m, source.Balance);
        }
Exemplo n.º 7
0
        public void TransferWithInsufficientFundsAtomicity()
        {
            Account source = new Account();

            source.Deposit(200m);

            Account destination = new Account();

            destination.Deposit(150m);

            try
            {
                source.TransferFunds(destination, 300m);
            }
            catch (InsufficientFundsException expected)
            {
            }

            Assert.AreEqual(200m, source.Balance);
            Assert.AreEqual(150m, destination.Balance);
        }