/**
  * @covers WindowsAzure\Table\TableRestProxy::batch
  * @covers WindowsAzure\Table\TableRestProxy::_createBatchRequestBody
  * @covers WindowsAzure\Table\TableRestProxy::_getOperationContext
  * @covers WindowsAzure\Table\TableRestProxy::_createOperationsContexts
  * @covers WindowsAzure\Table\TableRestProxy::_constructPutOrMergeEntityContext
  * @covers WindowsAzure\Table\Internal\MimeReaderWriter::encodeMimeMultipart
  * @covers WindowsAzure\Table\Internal\MimeReaderWriter::decodeMimeMultipart
  * @covers WindowsAzure\Table\Models\BatchResult::create
  * @covers WindowsAzure\Table\Models\BatchResult::_constructResponses
  * @covers WindowsAzure\Table\Models\BatchResult::_compareUsingContentId
  * @covers WindowsAzure\Common\Internal\ServiceRestProxy::sendContext
  */
 public function testBatchWithDifferentPKFail()
 {
     // Setup
     $name = 'batchwithwithdifferentpkfail';
     $this->createTable($name);
     $partitionKey = '123';
     $rk1 = '456';
     $rk3 = '458';
     $delete = TestResources::getTestEntity($partitionKey, $rk1);
     $update = TestResources::getTestEntity($partitionKey, $rk3);
     $this->restProxy->insertEntity($name, $delete);
     $this->restProxy->insertEntity($name, $update);
     $result = $this->restProxy->queryEntities($name);
     $entities = $result->getEntities();
     $delete = $entities[0];
     $update = $entities[1];
     $update->addProperty('CustomerPlace', EdmType::STRING, 'Redmond');
     $operations = new BatchOperations();
     $operations->addUpdateEntity($name, $update);
     $operations->addDeleteEntity($name, '125', $delete->getRowKey(), $delete->getETag());
     // Test
     $result = $this->restProxy->batch($operations);
     // Assert
     $this->assertTrue(true);
 }
 public function testParseEntities()
 {
     // Setup
     $atomSerializer = new AtomReaderWriter();
     $pk1 = '123';
     $pk2 = '124';
     $pk3 = '125';
     $e1 = TestResources::getTestEntity($pk1, '1');
     $e2 = TestResources::getTestEntity($pk2, '2');
     $e3 = TestResources::getTestEntity($pk3, '3');
     $e1->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.1131734Z\'"');
     $e2->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.4252358Z\'"');
     $e3->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.7533014Z\'"');
     $e1->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e2->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e3->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $expected = array($e1, $e2, $e3);
     $entitiesAtom = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
                     <feed xml:base="http://aogail2.table.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
                     <title type="text">queryentitieswithmultipleentities</title>
                     <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities</id>
                     <updated>2012-05-17T00:59:32Z</updated>
                     <link rel="self" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities" />
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.1131734Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>123</d:PartitionKey>
                             <d:RowKey>1</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.1131734Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.4252358Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>124</d:PartitionKey>
                             <d:RowKey>2</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.4252358Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.7533014Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>125</d:PartitionKey>
                             <d:RowKey>3</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.7533014Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     </feed>
                     ';
     // Test
     $actual = $atomSerializer->parseEntities($entitiesAtom);
     // Assert
     $this->assertEquals($expected, $actual);
 }