public void ShouldSetPropertiesFromConstructorArguments()
 {
     var loan = new HousingLoan(new LoanParameters {Amount = 500, Years=10 });
     Assert.AreEqual(500, loan.LoanAmount);
     Assert.AreEqual(120, loan.NumberOfMonths);
     Assert.AreEqual(500, loan.Remaining);
 }
        public PaymentPlan CalculateLoan(LoanParameters loanParameters)
        {
            var loan = new HousingLoan(loanParameters);
            var paymentScheme = new SeriesPaymentScheme();
            var months = new List<PaymentMonth>();
            
            for (int monthNumber = 1; monthNumber <= loan.NumberOfMonths; monthNumber++)
            {
                decimal monthlyPrincipal = paymentScheme.NextMonthlyPrincipal(loan);
                var monthlyInterest = paymentScheme.NextMonthlyInterest(loan);
                var monthlyTotal = monthlyPrincipal + monthlyInterest;
                loan.Remaining -= monthlyPrincipal; //TODO: This doesn't smell right, should be immutable or just a local variable?
                
                months.Add(new PaymentMonth(monthNumber, monthlyPrincipal, monthlyInterest, monthlyTotal, loan.Remaining));
            }

            var result = new PaymentPlan(months);

            return result;
        }
 public void ShouldHaveExpectedInterestRate()
 {
     var loan = new HousingLoan(new LoanParameters());
     Assert.AreEqual(1.035m, loan.InterestRate);
 }