public void Does_Get_Risk_Rate_Fuction_Work() { Assert.AreEqual(0.0172f, riskRate.GetRiskRate(30, 25000)); Assert.AreEqual(0.0165f, riskRate.GetRiskRate(30, 50000)); Assert.AreEqual(0.0165f, riskRate.GetRiskRate(30, 49000)); Assert.IsNull(riskRate.GetRiskRate(50, 500000)); Assert.AreEqual(0.2285f, riskRate.GetRiskRate(57, 1000000)); }
public float CalculateLifeInsurance(int age, int sumAssured) { float?riskRateValue = riskRate.GetRiskRate(age, sumAssured); float monthlyPremium = 0; if (riskRateValue != null) { monthlyPremium = GetMonthlyPremium((float)riskRateValue, sumAssured); } return(monthlyPremium); }