/**
  * @covers WindowsAzure\MediaServices\Models\ContentProperties::fromXml
  * @covers WindowsAzure\MediaServices\Models\ContentProperties::_fromXmlToArray
  * @covers WindowsAzure\MediaServices\Models\ContentProperties::getProperties
  */
 public function testFromXml()
 {
     // Setup
     $testString = 'testString';
     $nameKey = 'name';
     $objectKey = 'object';
     $xmlString = '<properties xmlns="' . Resources::DSM_XML_NAMESPACE . '" xmlns:d="' . Resources::DS_XML_NAMESPACE . '">
                    <d:' . $nameKey . '>' . $testString . '</d:' . $nameKey . '>
                    <d:' . $objectKey . '>
                      <d:element>
                        <d:' . $nameKey . '>' . $testString . '</d:' . $nameKey . '>
                      </d:element>
                    </d:' . $objectKey . '>
                   </properties>';
     $xml = simplexml_load_string($xmlString);
     $prop = new ContentProperties();
     // Test
     $prop->fromXml($xml);
     $result = $prop->getProperties();
     // Assert
     $this->assertEquals(2, count($result));
     $this->assertEquals($testString, $result[$nameKey]);
     $this->assertEquals(1, count($result[$objectKey]));
     $this->assertEquals(1, count($result[$objectKey][0]));
     $this->assertEquals($testString, $result[$objectKey][0][$nameKey]);
 }
 /**
  * Extract media service entity from Atom Entry object
  *
  * @param WindowsAzure\Common\Internal\Atom\Entry $entry Atom Entry containing
  * properties of media services object
  *
  * @return array
  */
 protected function getPropertiesFromAtomEntry($entry)
 {
     Validate::notNull($entry, 'entry');
     Validate::isA($entry, 'WindowsAzure\\Common\\Internal\\Atom\\Entry', 'entry');
     $result = array();
     $content = $entry->getContent();
     if (!empty($content)) {
         $propertiesXml = $content->getXml()->children(Resources::DSM_XML_NAMESPACE);
         $properties = new ContentProperties();
         $properties->fromXml($propertiesXml);
         $result = $properties->getProperties();
     }
     return $result;
 }