public void MonthlyApr_ReverseCalculation_ReturnsOriginalValue(decimal principal, double interestRate, int amortisationInYears) { var test = new AmortisedScheduleGenerator(principal, interestRate, NumberOfPayments, amortisationInYears, startDate, BankHolidays()); Math.Round(Math.Pow(1 + test.MonthlyApr(), 12) - 1, 2) .Should().Be(interestRate); }
public void Schedule_GeneratesExpectedTotalInterest(decimal principal, double interestRate, int amortisationInYears, decimal expected) { var test = new AmortisedScheduleGenerator(principal, interestRate, NumberOfPayments, amortisationInYears, startDate, BankHolidays()); Math.Round(test.MonthlyScheduleItems.Sum(x => x.InterestAmount), 2) .Should().Be(expected); }
public void MonthlyApr_ReturnsExpectedValue(decimal principal, double interestRate, int amortisationInYears, double expected) { var test = new AmortisedScheduleGenerator(principal, interestRate, NumberOfPayments, amortisationInYears, startDate, BankHolidays()); Math.Round(test.MonthlyApr(), 4) .Should().Be(expected); }
public void Schedule_ReturnsExpectedBalloonAmount(decimal principal, double interestRate, int amortisationInYears, decimal expected) { var test = new AmortisedScheduleGenerator(principal, interestRate, NumberOfPayments, amortisationInYears, startDate, BankHolidays()); Math.Round(test.BalloonAmount(), 2) .Should().Be(expected); }