public async Task <ActionResult> DeleteOperation(Guid id) { try { await _service.DeleteOperationById(id); return(NoContent()); } catch (KeyNotFoundException e) { return(NotFound(e.Message)); } }
public void EnsureOperationToDeleteNotFound() { Guid operationId = new Guid("22345678-1234-1234-1234-123412341234"); //mock Context context = ContextMocker.GetContextMock(); ContextMocker.SeedOperations(context); OperationService service = new OperationService(context); Assert.ThrowsAsync <KeyNotFoundException>(() => (service.DeleteOperationById(operationId))); }