예제 #1
0
        public void TransferMoneyHimselfTransferException()
        {
            var      accountManager = new AccountManager();
            var      client         = new PhysicalPersonClient("", "", "", DateTime.Now, ClientType.Usual);
            IAccount accountFrom    = new PhysicalPersonAccount(12, Currency.Rub, 500, client);

            accountFrom.Id = 1;

            decimal amountToTransfer = 500;

            Assert.Throws(typeof(HimselfTransferException),
                          () => { accountManager.TransferMoney(accountFrom, accountFrom, amountToTransfer); });
        }
예제 #2
0
        public void TransferMoneyCurrencyMismatchException()
        {
            var      accountManager = new AccountManager();
            var      client         = new PhysicalPersonClient("", "", "", DateTime.Now, ClientType.Usual);
            IAccount accountFrom    = new PhysicalPersonAccount(12, Currency.Usd, 5000, client);

            accountFrom.Id = 1;

            decimal  accountToAmount = 1000;
            IAccount accountTo       = new PhysicalPersonAccount(24, Currency.Rub, accountToAmount, client);

            accountTo.Id = 2;
            decimal amountToTransfer = 500;

            Assert.Throws(typeof(CurrencyMismatchException),
                          () => { accountManager.TransferMoney(accountFrom, accountTo, amountToTransfer); });
        }
예제 #3
0
        public void TransferMoneyValidResultCheck()
        {
            var      accountManager = new AccountManager();
            var      client         = new PhysicalPersonClient("", "", "", DateTime.Now, ClientType.Usual);
            IAccount accountFrom    = new PhysicalPersonAccount(12, Currency.Rub, 5000, client);

            accountFrom.Id = 1;

            decimal  accountToAmount = 1000;
            IAccount accountTo       = new PhysicalPersonAccount(24, Currency.Rub, accountToAmount, client);

            accountTo.Id = 2;
            decimal amountToTransfer = 500;

            accountManager.TransferMoney(accountFrom, accountTo, amountToTransfer);
            Assert.AreEqual(accountToAmount + amountToTransfer, accountTo.Amount, "ќшибка при обновлении суммы на счете получател¤.");
        }