Beispiel #1
0
        public void CanProperlyCalculateBalance()
        {
            var dueDate1 = new DateTimeOffset(new DateTime(2018, 1, 1));
            var dueDate2 = new DateTimeOffset(new DateTime(2018, 10, 1));
            var incomeDate = new DateTimeOffset(new DateTime(2018, 5, 1));

            PolicyAccount account = new PolicyAccount("D", "D");
            account.ExpectedPayment(10M, dueDate1);
            account.ExpectedPayment(15M, dueDate2);
            account.InPayment(25M, incomeDate);

            Equal(-10M, account.BalanceAt(dueDate1));
            Equal(15M, account.BalanceAt(incomeDate));
            Equal(0M, account.BalanceAt(dueDate2));
        }
Beispiel #2
0
        public void CanRegisterExpectdPayment()
        {
            var dueDate = new DateTimeOffset(new DateTime(2018, 1, 1));
            PolicyAccount account = new PolicyAccount("C", "C");
            account.ExpectedPayment(10M, dueDate);

            Equal(1, account.Entries.Count);
            Equal(-10M, account.BalanceAt(dueDate));
        }
        public void CanCloseAccountAndReturnMoney()
        {
            var dueDate = new DateTimeOffset(new DateTime(2018, 1, 1));
            var account = new PolicyAccount("C", "C", "E", "E");

            account.ExpectedPayment(10M, dueDate);
            account.InPayment(10M, dueDate);

            account.Close(new DateTime(2018, 6, 1), 5M);

            Equal(PolicyAccountStatus.Terminated, account.Status);
        }