示例#1
0
        public void GetTransactionListBetweenValidDates()
        {
            ICustomer customer = new Customer(1, "Name", "Address", "Phone", "Email");

            int          accNumber = 1;
            IBankAccount account   = BankAccount.CreateBankAccount(customer, accNumber);

            account.Deposit(1000);
            Thread.Sleep(1000);
            DateTime from = DateTime.Now;

            account.Withdraw(400);
            Thread.Sleep(1000);
            DateTime to = DateTime.Now;

            Thread.Sleep(1000);
            account.Deposit(200);

            Assert.AreEqual(3, account.Transactions.Count);
            IList <ITransaction> result = account.GetTransactions(from, to);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.AreSame(result[0], account.Transactions[1]);
        }
        public void PrintStatement()
        {
            var expectedTransactions = new List <Transaction>()
            {
                new Transaction(1000, new DateTime(2020, 08, 01), 1000)
            };

            bankAccount.GetTransactions().Returns(expectedTransactions);
            bankAccountController.PrintStatement();
            string[] expectedStatement = { "Date | Amount | Balance", "01/08/2020 | 1000 | 1000" };
            consolWrapper.Received().Write(Arg.Is <string[]>(x => IsEqual(x, expectedStatement)));
        }
        internal void PrintStatement()
        {
            var transactions = _bankAccount.GetTransactions();

            _consolWrapper.Write(BuildStatement(transactions));
        }