public function testFailedDelete()
 {
     $resourceId = 123;
     $errors = array('error');
     $controllerResult = new ResourceControllerResult(null, $errors);
     $this->controller->expects($this->once())->method('Delete')->with($this->equalTo($resourceId), $this->equalTo($this->server->GetSession()))->will($this->returnValue($controllerResult));
     $this->service->Delete($resourceId);
     $this->assertEquals(new FailedResponse($this->server, $errors), $this->server->_LastResponse);
     $this->assertEquals(RestResponse::BAD_REQUEST_CODE, $this->server->_LastResponseCode);
 }
 /**
  * @name DeleteResource
  * @description Deletes an existing resource
  * @response DeletedResponse
  * @param int $resourceId
  * @return void
  */
 public function Delete($resourceId)
 {
     Log::Debug('ResourcesWriteWebService.Delete() Resource=%s, UserId=%s', $resourceId, $this->server->GetSession()->UserId);
     $result = $this->controller->Delete($resourceId, $this->server->GetSession());
     if ($result->WasSuccessful()) {
         Log::Debug('ResourcesWriteWebService.Delete() - Resource Deleted. ResourceId=%s', $result->ResourceId());
         $this->server->WriteResponse(new DeletedResponse(), RestResponse::OK_CODE);
     } else {
         Log::Debug('ResourcesWriteWebService.Delete() - Resource Delete Failed.');
         $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()), RestResponse::BAD_REQUEST_CODE);
     }
 }