public function testWhenDeleteValidationFails()
 {
     $referenceNumber = '123';
     $errors = array('error');
     $controllerResult = new ReservationControllerResult($referenceNumber, $errors);
     $this->controller->expects($this->once())->method('Delete')->with($this->anything(), $this->anything(), $this->anything())->will($this->returnValue($controllerResult));
     $this->service->Delete($referenceNumber);
     $expectedResponse = new FailedResponse($this->server, $errors);
     $this->assertEquals($expectedResponse, $this->server->_LastResponse);
     $this->assertEquals(RestResponse::BAD_REQUEST_CODE, $this->server->_LastResponseCode);
 }
 /**
  * @name DeleteReservation
  * @description Deletes an existing reservation.
  * Pass an optional updateScope query string parameter to restrict changes. Possible values for updateScope are this|full|future
  * @response DeletedResponse
  * @param string $referenceNumber
  * @return void
  */
 public function Delete($referenceNumber)
 {
     Log::Debug('ReservationWriteWebService.Delete() User=%s, ReferenceNumber=%s', $this->server->GetSession()->UserId, $referenceNumber);
     $updateScope = $this->server->GetQueryString(WebServiceQueryStringKeys::UPDATE_SCOPE);
     $result = $this->controller->Delete($this->server->GetSession(), $referenceNumber, $updateScope);
     if ($result->WasSuccessful()) {
         Log::Debug('ReservationWriteWebService.Delete() - Reservation Deleted. ReferenceNumber=%s', $result->CreatedReferenceNumber());
         $this->server->WriteResponse(new DeletedResponse(), RestResponse::OK_CODE);
     } else {
         Log::Debug('ReservationWriteWebService.Delete() - Reservation Failed.');
         $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()), RestResponse::BAD_REQUEST_CODE);
     }
 }