public function testNonDefaultPropertiesMapToJsonString() { // Act $properties = new BrokerProperties(); $properties->setMessageId('foo'); $properties->setDeliveryCount(7); $json = $properties->toString(); // Assert $this->assertNotNull($json, '$json'); $this->assertEquals('{"DeliveryCount":7,"MessageId":"foo"}', $json, '$json'); }
/** * @covers WindowsAzure\ServiceBus\Models\BrokerProperties::toString */ public function testSerializeBrokerPropertiesAllPropertiesSuccess() { // Setup $expected = '{"CorrelationId":"testCorrelationId","SessionId":"testSessionId","DeliveryCount":38,"LockedUntilUtc":"Sun, 06 Nov 2011 01:00:00 GMT","LockToken":"testLockToken","MessageId":"testMessageId","Label":"testLabel","ReplyTo":"testReplyTo","SequenceNumber":88,"TimeToLive":123.456,"To":"testTo","ScheduledEnqueueTimeUtc":"Sun, 06 Nov 2011 01:00:00 GMT","ReplyToSessionId":"testReplyToSessionId","MessageLocation":"testMessageLocation","LockLocation":"testLockLocation"}'; $lockedUntilUtc = \DateTime::createFromFormat("Y-m-d H:i:s", "2011-11-06 01:00:00", new \DateTimeZone("UTC")); $timeToLive = '123.456'; $scheduledEnqueueTimeUtc = $lockedUntilUtc; // Test $brokerProperties = new BrokerProperties(); $brokerProperties->setCorrelationId('testCorrelationId'); $brokerProperties->setSessionId('testSessionId'); $brokerProperties->setDeliveryCount(38); $brokerProperties->setLockedUntilUtc($lockedUntilUtc); $brokerProperties->setLockToken('testLockToken'); $brokerProperties->setMessageId('testMessageId'); $brokerProperties->setLabel('testLabel'); $brokerProperties->setReplyTo('testReplyTo'); $brokerProperties->setSequenceNumber(88); $brokerProperties->setTimeToLive($timeToLive); $brokerProperties->setTo('testTo'); $brokerProperties->setScheduledEnqueueTimeUtc($scheduledEnqueueTimeUtc); $brokerProperties->setReplyToSessionId('testReplyToSessionId'); $brokerProperties->setMessageLocation('testMessageLocation'); $brokerProperties->setLockLocation('testLockLocation'); // Assert $this->assertEquals($expected, $brokerProperties->toString()); }