File tree Expand file tree Collapse file tree 2 files changed +24
-10
lines changed
sdk/servicebus/Azure.Messaging.ServiceBus Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -301,14 +301,12 @@ public TimeSpan TimeToLive
301301 /// </remarks>
302302 public string CorrelationId
303303 {
304- get => _correlationIdSet ? AmqpMessage . Properties . CorrelationId ? . ToString ( ) : AmqpMessage . Properties . CorrelationId . ToString ( ) ;
304+ get => AmqpMessage . Properties . CorrelationId ? . ToString ( ) ;
305305 set
306306 {
307- _correlationIdSet = true ;
308307 AmqpMessage . Properties . CorrelationId = value == null ? null : new AmqpMessageId ( value ) ;
309308 }
310309 }
311- private bool _correlationIdSet ;
312310
313311 /// <summary>Gets or sets an application specific subject.</summary>
314312 /// <value>The application specific subject.</value>
@@ -338,14 +336,12 @@ public string Subject
338336 /// </remarks>
339337 public string To
340338 {
341- get => _toSet ? AmqpMessage . Properties . To ? . ToString ( ) : AmqpMessage . Properties . To . ToString ( ) ;
339+ get => AmqpMessage . Properties . To ? . ToString ( ) ;
342340 set
343341 {
344- _toSet = true ;
345342 AmqpMessage . Properties . To = value == null ? null : new AmqpAddress ( value ) ;
346343 }
347344 }
348- private bool _toSet ;
349345
350346 /// <summary>Gets or sets the content type descriptor.</summary>
351347 /// <value>RFC2045 Content-Type descriptor.</value>
@@ -375,14 +371,12 @@ public string ContentType
375371 /// </remarks>
376372 public string ReplyTo
377373 {
378- get => _replyToSet ? AmqpMessage . Properties . ReplyTo ? . ToString ( ) : AmqpMessage . Properties . ReplyTo . ToString ( ) ;
374+ get => AmqpMessage . Properties . ReplyTo ? . ToString ( ) ;
379375 set
380376 {
381- _replyToSet = true ;
382377 AmqpMessage . Properties . ReplyTo = value == null ? null : new AmqpAddress ( value ) ;
383378 }
384379 }
385- private bool _replyToSet ;
386380
387381 /// <summary>
388382 /// Gets or sets the date and time in UTC at which the message will be enqueued. This
Original file line number Diff line number Diff line change @@ -1349,10 +1349,30 @@ public async Task NullableAmqpPropertiesRoundTripCorrectly()
13491349 Assert . IsNull ( receivedMessage . To ) ;
13501350 Assert . IsNull ( receivedMessage . CorrelationId ) ;
13511351
1352- // verify default behavior for backcompat
1352+ // verify default null behavior
13531353
13541354 message = new ServiceBusMessage ( ) ;
13551355
1356+ Assert . IsNull ( message . ReplyTo ) ;
1357+ Assert . IsNull ( message . To ) ;
1358+ Assert . IsNull ( message . CorrelationId ) ;
1359+
1360+ await sender . SendMessageAsync ( message ) ;
1361+
1362+ receivedMessage = await receiver . ReceiveMessageAsync ( ) ;
1363+ Assert . IsNull ( receivedMessage . ReplyTo ) ;
1364+ Assert . IsNull ( receivedMessage . To ) ;
1365+ Assert . IsNull ( receivedMessage . CorrelationId ) ;
1366+
1367+ // verify empty string respected
1368+
1369+ message = new ServiceBusMessage
1370+ {
1371+ ReplyTo = "" ,
1372+ To = "" ,
1373+ CorrelationId = ""
1374+ } ;
1375+
13561376 Assert . AreEqual ( "" , message . ReplyTo ) ;
13571377 Assert . AreEqual ( "" , message . To ) ;
13581378 Assert . AreEqual ( "" , message . CorrelationId ) ;
You can’t perform that action at this time.
0 commit comments