public void CalculateBloodAlcoholIsNonZero() { var beers = new Beer[] { new Beer { Abv = 5 } }; var expected = 0d; var actual = _sut.Calculate(225, 5, Sex.Male, beers); Assert.Equal(expected, actual); }
public ActionResult CalculateFromBodyAsModel( [FromBody] BacCalculationRequest request, [FromServices] IBloodAlcoholCalculator calculator) => new JsonResult(new { BloodAlcoholContent = calculator.Calculate( request.WeightInPounds, request.HoursOfDrinking, request.Sex, request.Beers) });
public ActionResult CalculateFromRoute( [FromRoute] int weight, [FromRoute] float hours, [FromRoute] Sex sex, [FromQuery] double[] abvs, [FromServices] IBloodAlcoholCalculator calculator) => new JsonResult(new { BloodAlcoholContent = calculator.Calculate( weight, hours, sex, abvs) });