public FareCalculatorControllerTests(CustomWebApplicationFactory <Startup> factory) { tripDetailDto = new TripDetailDto() { CityBasedSurchargeAmount = 0.5, LessThan6MilesPerHourSpeedRangeIndicator = 2, MoreThan6MilesPerHourOr60SecondsDurationIndicator = 5, TripDate = Convert.ToDateTime("01/17/2020 5:30pm") }; _client = factory.CreateClient(); }
public IActionResult Get([FromQuery] TripDetailDto input) { if (input.LessThan6MilesPerHourSpeedRangeIndicator < 0) { return(BadRequest("LessThan6MilesPerHourSpeedRangeIndicator could not be less than 0!")); } if (input.MoreThan6MilesPerHourOr60SecondsDurationIndicator < 0) { return(BadRequest("MoreThan6MilesPerHourOr60SecondsDurationIndicator could not be less than 0!")); } var tripDetail = _mapper.Map <TripDetail>(input); var fareDetails = _fareCalculatorProvider.CalculateFare(tripDetail); _log.LogInformation($"Rate: {fareDetails.CalculatedFare}"); return(Ok(fareDetails.CalculatedFare)); }