Example #1
0
        public void ShouldCalculateMonthlyPaymentWhenInputValid()
        {
            var monthlyPaymentAmount = MortgageInstallmentCalculator.CalculateMonthlyPayment(1000, 1, 12);

            Assert.AreEqual(88.8487886783416d, monthlyPaymentAmount, 0.01d);
        }
Example #2
0
 public void ShouldThrowInvalidInputExceptionOnNegativeInterestRate()
 {
     MortgageInstallmentCalculator.CalculateMonthlyPayment(20, 1, -12);
 }
Example #3
0
 public void ShouldThrowInvalidInputExceptionOnNegativePrincipalAmount()
 {
     MortgageInstallmentCalculator.CalculateMonthlyPayment(20, -10, 14.5);
 }
Example #4
0
 public void ShouldThrowInvalidInputExceptionOnNegativeTenure()
 {
     MortgageInstallmentCalculator.CalculateMonthlyPayment(-20, 1, 14.5);
 }