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