示例#1
0
        public async Task <ActionResult> DeleteOperation(Guid id)
        {
            try
            {
                await _service.DeleteOperationById(id);

                return(NoContent());
            }
            catch (KeyNotFoundException e)
            {
                return(NotFound(e.Message));
            }
        }
示例#2
0
        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)));
        }