예제 #1
0
        public void saves_schedule_and_transaction_with_loan()
        {
            var type = new StandardLoanType()
            {
                Id = 1, Name = "Standard"
            };
            var loan = new Loan()
            {
                Balance = 1000, Date = DateTime.UtcNow, LoanAmount = 1000, Status = LoanStatus.Live, LoanType = type
            };

            loan.Schedule.Add(new LoanScheduleItem()
            {
                AmountDue = 333, Date = DateTime.UtcNow.AddDays(1), Interest = 10
            });
            loan.Schedule.Add(new LoanScheduleItem()
            {
                AmountDue = 333, Date = DateTime.UtcNow.AddDays(2), Interest = 10
            });
            loan.Schedule.Add(new LoanScheduleItem()
            {
                AmountDue = 333, Date = DateTime.UtcNow.AddDays(3), Interest = 10
            });
            using (var tx = _session.BeginTransaction())
            {
                _session.Save(type);
                _session.Save(loan);
                tx.Commit();
            }
        }
예제 #2
0
        public void standard_balances()
        {
            var lt       = new StandardLoanType();
            var balances = lt.GetBalances(1000, 3).ToArray();

            Assert.That(balances.Length, Is.EqualTo(3));

            Assert.That(balances[0], Is.EqualTo(666));
            Assert.That(balances[1], Is.EqualTo(333));
            Assert.That(balances[2], Is.EqualTo(0));
        }
예제 #3
0
        public void SetUp()
        {
            _session = CreateSession();
            _lhrepo  = new LoanHistoryRepository(_session);

            using (var tx = _session.BeginTransaction())
            {
                var type = new StandardLoanType()
                {
                    Id = 1, Name = "Standard"
                };
                _loan = new Loan()
                {
                    LoanType = type
                };
                _session.Save(type);
                _session.Save(_loan);
                tx.Commit();
            }
        }