Пример #1
0
        static void Main(string[] args)
        {
            BankAccountStorage storage = new BankAccountStorage("BankAccountStorage.bin");

            BankAccountService service = new BankAccountService();

            BankAccount account1 = new BankAccount("454545nn45", "Ivan", "Petrov", 596.30m, 0.15, BancAccountType.Gold);
            BankAccount account2 = new BankAccount("56dj8533d2", "Sergei", "Sidorov", 0m, 0, BancAccountType.Base);
            BankAccount account3 = new BankAccount("45jnd45snn", "Elena", "Ivanova", 100m, 1, BancAccountType.Platinum);

            List <BankAccount> bankAccounts = new List <BankAccount>()
            {
                account1, account2, account3
            };

            ListInput(bankAccounts);

            service.WriteAccounts(storage, bankAccounts);

            service.WithdrawMoney(100m, bankAccounts[0]);
            service.DepositMoney(10m, bankAccounts[1]);
            service.CloseAccount(bankAccounts[2]);
            ListInput(bankAccounts);

            bankAccounts = service.ReadAccounts(storage);
            ListInput(bankAccounts);

            Console.ReadLine();
        }
        public void BLL_DepositExecute_Test(string lastName, string firstName, string accountID,
                                            decimal invoiceAmount, double bonusScores, decimal withdrawAmount)
        {
            BankAccount account = new BaseAccount(new AccountOwner(firstName, lastName), accountID, invoiceAmount, bonusScores);
            var         mock    = new Mock <IRepository>();

            mock.Setup(a => a.FindAccountByID(accountID)).Returns(account);
            IAccountService service = new BankAccountService(mock.Object);

            service.DepositMoney(accountID, withdrawAmount);

            Assert.AreEqual(600, account.InvoiceAmount);
        }