Ejemplo n.º 1
0
        public IActionResult GetPremium(PremiumCalcRequest userData)
        {
            var premiumReq = _mapper.Map <PremiumRequestView>(userData);
            var response   = _mapper.Map <PremiumResponse>(_premiumService.CalculatePremium(premiumReq));

            return(Ok(response));
        }
Ejemplo n.º 2
0
        public async Task <MemberModel> CalculatePremium(MemberModel memberModel)
        {
            await EnrichDetails(memberModel);

            memberModel.Premium = _premiumService.CalculatePremium(memberModel).Premium;
            return(memberModel);
        }
        public void CalculatePremium_Should_Return_Premium_When_Input_Is_Valid(int age, string sumInsured, decimal factor)
        {
            _premiumService = new PremiumService();

            var premium = _premiumService.CalculatePremium(age, sumInsured, factor);

            Assert.IsNotNull(premium);
        }
        public CalculateResponse Get(string age, string occupation, string suminsured)
        {
            var usr = new UserDetails()
            {
                Age        = Convert.ToInt32(age),
                Occupation = occupation,
                SumInsured = Convert.ToInt32(suminsured)
            };

            return(new CalculateResponse
            {
                calculatedPremium = _premiumService.CalculatePremium(usr)
            });
        }
Ejemplo n.º 5
0
        public JsonResult CalculatePremium(int occupation, int age, int deathcoveramount)
        {
            string amount = "";

            try
            {
                amount = premiumService.CalculatePremium(occupation, age, deathcoveramount).ToString("c");
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message + "\n" + e.StackTrace);
            }
            return(Json(amount, JsonRequestBehavior.AllowGet));
        }
        public void CalculatePremium_Should_Throw_Exception_When_Input_Is_InValid(int age, string sumInsured, decimal factor)
        {
            _premiumService = new PremiumService();

            Assert.Throws <Exception>(() => _premiumService.CalculatePremium(age, sumInsured, factor));
        }