public void Format_Should_Return_Header() { var statementFormat = new StatementFormat(); var result = statementFormat.Format(new List <Transaction>()); Assert.AreEqual("date || credit || debit || balance\n", result); }
public void Setup() { // Arrange _transactionRepository = Substitute.For <TransactionRepository>(); _statementFormat = Substitute.For <StatementFormat>(); _clock = Substitute.For <Clock>(); _account = new Account(_transactionRepository, _statementFormat, _clock); }
public void Format_Should_Return_A_Credit() { var statementFormat = new StatementFormat(); var transactions = new List <Transaction> { new Transaction(new DateTime(2012, 01, 10), 1000) }; var result = statementFormat.Format(transactions); Assert.AreEqual("date || credit || debit || balance\n" + "10/01/2012 || 1000 || || 1000\n", result); }
public void IntegrationTest() { var transcationrepository = new TransactionRepository(); var statementFormat = new StatementFormat(); var clock = Substitute.For <Clock>(); clock.today().Returns(new DateTime(2012, 01, 10), new DateTime(2012, 01, 13), new DateTime(2012, 01, 14)); var account = new Account(transcationrepository, statementFormat, clock); account.Deposit(1000); account.Deposit(2000); account.Withdraw(500); var expectedResult = account.Statement(); Assert.AreEqual(expectedResult, "date || credit || debit || balance\n" + "14/01/2012 || || 500 || 2500\n" + "13/01/2012 || 2000 || || 3000\n" + "10/01/2012 || 1000 || || 1000\n"); }
public Account(TransactionRepository transactionRepository, StatementFormat statementFormat, Clock clock) { _clock = clock; _statementFormat = statementFormat; _transactionRepository = transactionRepository; }