コード例 #1
0
        public IActionResult GetPremium([FromBody] GetPremiumRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            decimal          premium = 0;
            OccupationRating rating  = _occupationService.GetOccupationRating(request.OccupationRating);

            if (rating != null)
            {
                premium = _premiumService.GetPremium(request.SumInsured, rating.Factor, request.Age);
            }

            return(Ok(premium));
        }
コード例 #2
0
 public void GetPremiumArgumentExceptionTest(int sumInsured, decimal ratingFactor, int age)
 {
     Assert.That(() => _premiumService.GetPremium(sumInsured, ratingFactor, age), Throws.TypeOf <ArgumentException>());
 }