예제 #1
0
        public void CorrectFinalPremiumCalculated()
        {
            ApplicantDetails app = new ApplicantDetails();

            app.Age             = 36;
            app.isMale          = true;
            app.Country         = CountryOfResidence.Country.England;
            app.HasChildren     = true;
            app.IsSmoker        = false;
            app.WeeklyExcercise = 2;

            CalculateQuote CQ = new CalculateQuote();

            Assert.AreEqual(CQ.CalculateFinalQuote(app), 375);
        }
예제 #2
0
        public decimal ReturnBasePrice(ApplicantDetails App)
        {
            List <BasePrice> list = LoadBasePrice();

            foreach (BasePrice Price in list)
            {
                if (App.Age >= Price.LowerAge && App.Age <= Price.MaxAge)
                {
                    if (App.isMale == Price.isMale)
                    {
                        return(Price.Base);
                    }
                }
            }

            CalculateQuote foo = new CalculateQuote();

            foo.CalculationError("Base Premium");
            return(0);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Life Insurance Quote Calculator");

            ApplicantDetails quote = new DataCollection().CollectQuoteData();

            Console.WriteLine("Thank you, calculating your quote");

            CalculateQuote CQ      = new CalculateQuote();
            decimal        premium = CQ.CalculateFinalQuote(quote);

            if (premium < CQ.MinimumPremium)
            {
                premium = CQ.MinimumPremium;
            }

            Console.WriteLine("Your Life Insurance Quote is {0}", premium.ToString("C0"));
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }