public void Delete_return_bad_test() { IConsumedFoods consumedFoodsClass = GetConsumedFoods(); ConsumedFoodsModel consumedFood = GetConsumedFoodForTest(); consumedFood.IdFood = "Invalid_food"; Assert.ThrowsException <Exception>(() => consumedFoodsClass.Delete(consumedFood)); }
public void Delete_return_ok_test() { IConsumedFoods consumedFoodsClass = GetConsumedFoods(); ConsumedFoodsModel consumedFood = GetConsumedFoodForTest(); ConsumedFoodsResponse response = consumedFoodsClass.Delete(consumedFood); Assert.IsTrue(response.IsValid); }
public IActionResult Delete([FromBody] ConsumedFoodsModel consumedFood) { try { response = _responseHandler.ProcessResponse(_consumedFoods.Delete(consumedFood)); } catch (Exception exception) { response = new BadRequestObjectResult(exception); } return(response); }