public void TestMonthlyInsurancePayment()
 {
     LoanData loanData = new LoanData(400000.00, 50, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     double monthlyInsurance = loanData.InsuranceYearly / 12;
     monthlyInsurance = Math.Round(monthlyInsurance);
     Assert.AreEqual(62.00d, monthlyInsurance);
 }
 public void TestMonthlyHoaPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     double monthlyHoa = loanData.HoaDuesYearly / 12;
     monthlyHoa = Math.Round(monthlyHoa, 2);
     Assert.AreEqual(50.00d, monthlyHoa);
 }
 public ActionResult Index(LoanData loanData)
 {
     if (ModelState.IsValid) {
         loanData.CalculateTotalMonthlyPayment();
         ViewData["MonthlyPayment"] = Math.Round(loanData.MonthlyPayment, 2);
         ViewData["Principal"] = Math.Round(loanData.PrincipalOnlyMonthly, 2);
         ViewData["Interest"] = Math.Round(loanData.InterestOnlyMonthly, 2);
         ViewData["PropertyTax"] = Math.Round(loanData.MonthlyPropertyTaxPayment, 2);
         ViewData["Pmi"] = Math.Round(loanData.MonthlyPmiPayment, 2);
         ViewData["Hoa"] = Math.Round(loanData.HoaDuesYearly / 12, 2);
         ViewData["Insurance"] = Math.Round(loanData.InsuranceYearly / 12, 2);
         return View("Index", loanData);
     } else {
         return View();
     }
 }
 public void TestTotalMonthlyPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     Assert.AreEqual(1674.57, Math.Round(loanData.MonthlyPayment, 2));
 }
 public void TestPrincipalCalculation()
 {
     LoanData loanData = new LoanData(200000.00, 50, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     Assert.AreEqual(100000.00, Math.Round(loanData.Principal, 2));
 }
 public void TestMonthlyPropertyTaxPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     Assert.AreEqual(460.00, Math.Round(loanData.MonthlyPropertyTaxPayment, 2));
 }
 public void TestMonthlyPrincipalPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     double principalMonthly = Math.Round(loanData.PrincipalOnlyMonthly, 2);
     Assert.AreEqual(281.80d, principalMonthly);
 }
 public void TestMonthlyPrincipalAndInterestPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     double principalAndInterest = loanData.InterestOnlyMonthly + loanData.PrincipalOnlyMonthly;
     Assert.AreEqual(969.30d, Math.Round(principalAndInterest, 2));
 }
 public void TestMonthlyInterestPayment()
 {
     LoanData loanData = new LoanData(200000.00, 0, 4.125, 30, 2.76, 0.8, 600.00, 743.27);
     Assert.AreEqual(687.50d, Math.Round(loanData.InterestOnlyMonthly, 2));
 }