Exemplo n.º 1
0
        public InMemoryTransactionStoreTests()
        {
            timeProvider = A.Fake <IProvideTime>();
            A.CallTo(() => timeProvider.TodayAsString()).Returns(Today);

            transactionStore = new InMemoryTransactionStore(timeProvider);
        }
Exemplo n.º 2
0
        public void Contains_all_transactions()
        {
            A.CallTo(() => timeProvider.TodayAsString())
            .ReturnsNextFromSequence(new[] { "01/04/2014", "02/04/2014", "10/04/2014" });

            account.Deposit(1000);
            account.Withdrawal(100);
            account.Deposit(500);

            account.PrintStatement();

            A.CallTo(() => textPrinter.PrintLine("DATE | AMOUNT | BALANCE")).MustHaveHappened()
            .Then(A.CallTo(() => textPrinter.PrintLine("10/04/2014 | 500.00 | 1400.00")).MustHaveHappened())
            .Then(A.CallTo(() => textPrinter.PrintLine("02/04/2014 | -100.00 | 900.00")).MustHaveHappened())
            .Then(A.CallTo(() => textPrinter.PrintLine("01/04/2014 | 1000.00 | 1000.00")).MustHaveHappened());
        }
Exemplo n.º 3
0
        public void AddDeposit(int amount)
        {
            var deposit = new Transaction(timeProvider.TodayAsString(), amount);

            transactions.Add(deposit);
        }