/**
  * @covers WindowsAzure\Table\Models\QueryEntitiesResult::create
  */
 public function testCreate()
 {
     // Test
     $result = QueryEntitiesResult::create(array(), array());
     // Assert
     $this->assertCount(0, $result->getEntities());
     $this->assertNull($result->getNextPartitionKey());
     $this->assertNull($result->getNextRowKey());
 }
 /**
  * Quries entities for the given table name
  * 
  * @param string                                           $table   The name of
  * the table.
  * @param Models\QueryEntitiesOptions|string|Models\Filter $options Coule be
  * optional parameters, query string or filter to apply.
  * 
  * @return Models\QueryEntitiesResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179421.aspx
  */
 public function queryEntities($table, $options = null)
 {
     Validate::isString($table, 'table');
     Validate::notNullOrEmpty($table, 'table');
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $statusCode = Resources::STATUS_OK;
     $path = $table;
     if (is_null($options)) {
         $options = new QueryEntitiesOptions();
     } else {
         if (is_string($options)) {
             $queryString = $options;
             $options = new QueryEntitiesOptions();
             $options->setFilter(Filter::applyQueryString($queryString));
         } else {
             if ($options instanceof Filter) {
                 $filter = $options;
                 $options = new QueryEntitiesOptions();
                 $options->setFilter($filter);
             }
         }
     }
     $queryParams = $this->_addOptionalQuery($queryParams, $options->getQuery());
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_NEXT_PK, $options->getNextPartitionKey());
     $this->addOptionalQueryParam($queryParams, Resources::QP_NEXT_RK, $options->getNextRowKey());
     $this->addOptionalHeader($headers, Resources::CONTENT_TYPE, Resources::XML_ATOM_CONTENT_TYPE);
     if (!is_null($options->getQuery())) {
         $dsHeader = Resources::DATA_SERVICE_VERSION;
         $maxdsValue = Resources::MAX_DATA_SERVICE_VERSION_VALUE;
         $fields = $options->getQuery()->getSelectFields();
         $hasSelect = !empty($fields);
         if ($hasSelect) {
             $this->addOptionalHeader($headers, $dsHeader, $maxdsValue);
         }
     }
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $entities = $this->_atomSerializer->parseEntities($response->getBody());
     return QueryEntitiesResult::create($response->getHeader(), $entities);
 }