public void DivOperationWithoutTrackingId() { var dividend = 11; var divisor = 2; var expectedResult = 5; var expectedRemainder = 1; var result = _mathService.Div(dividend, divisor); Assert.IsNotNull(result); Assert.AreEqual(result.Quotient, expectedResult); Assert.AreEqual(result.Remainder, expectedRemainder); }
public IActionResult Div([FromBody] DivRequest divRequest) { Log.Debug("Div"); if (!ModelState.IsValid) { return(GetError(StatusCodes.Status400BadRequest)); } try { var result = _mathService.Div(divRequest.Dividend, divRequest.Divisor, Request.GetHeader(CalculatorServiceConstants.EvilTrackingHeader)); if (result != null) { return(Ok(new DivResponse(result.Quotient, result.Remainder))); } } catch (Exception ex) { Log.Error(ex.Message); } return(GetError(StatusCodes.Status500InternalServerError)); }