예제 #1
0
 public void Print_WhenNoTransactions_HeaderOnlyIsPrinted()
 {
     var console = new Mock<IConsole>();
     var statementPrinter = new StatementPrinter(console.Object);
     statementPrinter.Print(new List<Transaction>());
     console.Verify(x => x.PrintLine("DATE | AMOUNT | BALANCE"));
 }
예제 #2
0
        public void Print_WhenMultipleTransactions_TransactionsPrintedInReverseChronologicalOrder()
        {
            var console = new Mock<IConsole>();
            var statementPrinter = new StatementPrinter(console.Object);

            var transactions = new List<Transaction>
            {
                new Transaction(-50, "10/04/2014"),
                new Transaction(100, "12/04/2014"),
                new Transaction(1000, "11/04/2014")
            };

            statementPrinter.Print(transactions);

            console.Verify(x => x.PrintLine("DATE | AMOUNT | BALANCE"));
            console.Verify(x => x.PrintLine("12/04/2014 | 100.00 | 1050.00"));
            console.Verify(x => x.PrintLine("11/04/2014 | 1000.00 | 950.00"));
            console.Verify(x => x.PrintLine("10/04/2014 | -50.00 | -50.00"));
        }
예제 #3
0
        public void PrintStatement()
        {
            var statementPrinter = new StatementPrinter(_console);

            statementPrinter.Print(Repository.GetAllTransactions());
        }