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)); }
public void GetPremiumArgumentExceptionTest(int sumInsured, decimal ratingFactor, int age) { Assert.That(() => _premiumService.GetPremium(sumInsured, ratingFactor, age), Throws.TypeOf <ArgumentException>()); }