public async Task <IActionResult> Get([FromQuery] DateTime dateOfBirth, [FromQuery] int occupationId, [FromQuery] double deathCover, [FromQuery] double monthlyExpense) { var result = await _premiumService.Calculate(dateOfBirth.Age() , occupationId , deathCover , monthlyExpense); return(Ok(result)); }
public async Task CalculateTest_Returns_DeathPremium(DateTime dateOfBirth, int occupationId, double deathCoverAmount, double monthlyExpense) { // Arrange _occupationsRepository.Get(occupationId).Returns(Task.FromResult(new Data.Entities.Occupation { Id = 1, Label = "", Rating = new Data.Entities.Rating { Id = 1, Factor = 1.1 } })); // Act var result = await _premiumService.Calculate(dateOfBirth.Age(), occupationId, deathCoverAmount, monthlyExpense); // Assert result.ShouldNotBeNull(); result.DeathPremium.ShouldBeGreaterThan(0); result.YearlyCover.ShouldBeGreaterThan(0); }
public ActionResult CalculatePremium([FromBody] PremiumCalculationRequest obj) { var result = _premiumService.Calculate(obj, env); return(Ok(result)); }