public ActionResult <int> Post([FromBody] RequestBody body) { int[] scooters = body.Scooters; int c = body.C; int p = body.P; try { _paramvValidator.Validate(scooters, c, p); } catch (Exception e) { Response.StatusCode = 400; // Bad Request return(Content(e.Message)); } return(_countService.CountMinFE(scooters, c, p)); }
public void TestFEMinBoundaries() { //Arrange int c = 10; int p = -1; int[] scooters = { 10, 55, 5 }; //Act try { validator.Validate(scooters, c, p); Assert.True(false, ""); } //Assert catch (Exception e) { Assert.Equal("Incorrect number of Scooters For FE", e.Message); } }