public void P_IsCalculatedCorrectly(double m, double n, double k0, double e, double kn, double expectedP) { kn *= -1; const double localTolerance = 0.001; var pNom = FinancialCalculation.P(kn, k0, e, n, m); var pEff = FinancialCalculation.GetEffectiveInterestRate(pNom, m); Assert.True(Math.Abs(pEff - expectedP) < localTolerance); }
public void EffectiveInterestRateIsCalculatedCorrectly(double m, double p, double expectedEffectiveInterestRate) { var effectiveInterestRate = FinancialCalculation.GetEffectiveInterestRate(p, m); Assert.Equal(Math.Round(effectiveInterestRate, 3), expectedEffectiveInterestRate); }