Example #1
0
        public void Should_AddTransactionValue()
        {
            FinancialDay day    = Tester.GetToday();
            decimal      income = 500;

            day.AddTransaction(new MockTransaction()
            {
                Value = income
            }.Object);
            Assert.AreEqual(income, day.EndingBalance);
        }
Example #2
0
        public void Should_SubtractNegativeTransactionValue()
        {
            FinancialDay day     = Tester.GetToday();
            decimal      expense = -500;

            day.AddTransaction(new MockTransaction()
            {
                Value = expense
            }.Object);
            Assert.AreEqual(expense, day.EndingBalance);
        }
Example #3
0
        public void Should_AddBalance_To_StartOfDayStatement()
        {
            FinancialDay day     = Tester.GetToday();
            decimal      balance = 1000;

            day.AddStatement(new Statement(balance, AddWhen.StartOfDay));

            decimal income = 500;

            day.AddTransaction(new MockTransaction()
            {
                Value = income
            }.Object);

            Assert.AreEqual(balance + income, day.EndingBalance);
        }
Example #4
0
        public void Should_EndWithStatementBalance_Over_Transactions_When_EndOfDay()
        {
            FinancialDay day     = Tester.GetToday();
            decimal      balance = 1000;

            day.AddStatement(new Statement(balance, AddWhen.EndOfDay));

            decimal income = 500;

            day.AddTransaction(new MockTransaction()
            {
                Value = income
            }.Object);

            Assert.AreEqual(balance, day.EndingBalance);
        }
Example #5
0
        public void Should_AddTransactions_To_PreviousDays_EndingBalance()
        {
            FinancialDay day     = Tester.GetToday();
            decimal      balance = 2000;

            day.PreviousDay = new MockBalance(null, balance)
            {
                HasStatementOnLeft = true
            }.Object;
            Assert.AreEqual(balance, day.StartingBalance);

            decimal income = 500;

            day.AddTransaction(new MockTransaction()
            {
                Value = income
            }.Object);

            Assert.AreEqual(balance + income, day.EndingBalance);
        }