public void CalculatePremiumForInitialAndAdditionalSetOfRisks() { var additionalinsurancePeriod = new InsurancePeriod(DateTime.Now.AddMonths(6), 6); var additionalRisk = new Risk { Name = fixture.Create <string>(), YearlyPrice = 50 }; var riskInsuredPeriod = new RiskInsurancePeriod(additionalinsurancePeriod, additionalRisk); var insurancePeriod = new InsurancePeriod(DateTime.Now, 12); var insuredRisks = new List <Risk> { new Risk { Name = fixture.Create <string>(), YearlyPrice = 40m }, new Risk { Name = fixture.Create <string>(), YearlyPrice = 36m } }; var initialRiskSet = new InitialRiskSet(insuredRisks, insurancePeriod, riskInsuredPeriod); var premium = initialRiskSet.CalculatePremium(); Assert.Equal(101m, premium); }
public void PropagateRiskName() { var validFrom = DateTime.Now; var validTill = DateTime.Now.AddDays(1); var insurancePeriod = new InsurancePeriod(validFrom, validTill); var risk = fixture.Create <Risk>(); var riskInsurancePeriod = new RiskInsurancePeriod(insurancePeriod, risk); Assert.Equal(risk.Name, riskInsurancePeriod.RiskName); }
public void CalculatePremiumForEachValidMonth() { var validFrom = DateTime.Now; var validTill = DateTime.Now.AddMonths(2); var insurancePeriod = new InsurancePeriod(validFrom, validTill); var risk = new Risk { Name = fixture.Create <string>(), YearlyPrice = 120 }; var riskInsurancePeriod = new RiskInsurancePeriod(insurancePeriod, risk); var premium = riskInsurancePeriod.CalculatePremium(); Assert.Equal(20, premium); }