示例#1
0
        public void GivenPremiumCalculator_Revisited_Again_Before_WhenCalculatePremiumOnAboveRiskAgeLowerBoundarySmokerBikeOwner_ReturnsAmmountWithVeryHighRiskInsuranceMultiplier()
        {
            var policyHolderInfo = new PolicyHolderInfo
            {
                Age            = 35,
                IsSmoker       = true,
                OwnsMotorcycle = true
            };
            var premiumCalculator = new PremiumCalculator_Revisited_Again_Before();

            var result = premiumCalculator.CalculatePremium(policyHolderInfo, 10000);

            Assert.AreEqual(20000, result);
        }
示例#2
0
        public void GivenPremiumCalculator_Revisited_Again_After_WhenIsVeryHighRisk_ReturnsTrueForHighRiskPolicyHolders()
        {
            var policyHolderInfo = new PolicyHolderInfo
            {
                Age            = 35,
                IsSmoker       = true,
                OwnsMotorcycle = true
            };
            var premiumCalculator = new PremiumCalculator_Revisited_Again_After();

            var result = premiumCalculator.IsVeryHighRisk(policyHolderInfo);

            Assert.IsTrue(result);
        }
示例#3
0
 public decimal CalculatePremium(PolicyHolderInfo policyHolderInfo, decimal insuranceSum)
 {
     if (policyHolderInfo.Age > RiskAgeLowerBoundary && policyHolderInfo.IsSmoker && policyHolderInfo.OwnsMotorcycle)
     {
         return(insuranceSum * VeryHighRiskInsuranceMultiplier);
     }
     else if (policyHolderInfo.Age > RiskAgeLowerBoundary && policyHolderInfo.IsSmoker && !policyHolderInfo.OwnsMotorcycle)
     {
         return(insuranceSum * HighRiskInsuranceMultiplier);
     }
     else if (policyHolderInfo.Age > RiskAgeLowerBoundary && !policyHolderInfo.IsSmoker && policyHolderInfo.OwnsMotorcycle)
     {
         return(insuranceSum * MediumRiskInsuranceMultiplier);
     }
     else if (policyHolderInfo.Age > RiskAgeLowerBoundary && !policyHolderInfo.IsSmoker && !policyHolderInfo.OwnsMotorcycle)
     {
         return(insuranceSum * LowRiskInsuranceMultiplier);
     }
     else
     {
         return(insuranceSum);
     }
 }
示例#4
0
 public decimal CalculatePremium(PolicyHolderInfo policyHolderInfo, decimal insuranceSum)
 {
     if (IsVeryHighRisk(policyHolderInfo))
     {
         return(insuranceSum * VeryHighRiskInsuranceMultiplier);
     }
     else if (IsHighRisk(policyHolderInfo))
     {
         return(insuranceSum * HighRiskInsuranceMultiplier);
     }
     else if (IsMediumRisk(policyHolderInfo))
     {
         return(insuranceSum * MediumRiskInsuranceMultiplier);
     }
     else if (IsLowRisk(policyHolderInfo))
     {
         return(insuranceSum * LowRiskInsuranceMultiplier);
     }
     else // IsNoRisk
     {
         return(insuranceSum);
     }
 }
示例#5
0
 public virtual bool IsLowRisk(PolicyHolderInfo policyHolderInfo)
 {
     return(policyHolderInfo.Age > RiskAgeLowerBoundary && !policyHolderInfo.IsSmoker && !policyHolderInfo.OwnsMotorcycle);
 }