public async Task DeleteModelSucess() { var model = new Car() { Id = 15, }; await _repository.Add(model); Exception exception = null; try { await _service.Execute(15); }catch (Exception ex) { exception = ex; } Assert.AreEqual(exception, null); }
public async Task <IActionResult> Delete(int id) { try { await _delete.Execute(id); return(StatusCode(204)); } catch (CarNotFoundException err) { return(StatusCode(404, new { Message = err.Message })); } }