@@ -351,11 +351,8 @@ public void ValidateMessagesFromGo()
351351 Assert . Equal ( "test" , msgStaticTest . Properties . GroupId ) ;
352352 Assert . Equal ( "test" , msgStaticTest . Properties . ReplyToGroupId ) ;
353353 Assert . Equal ( "test" , Encoding . Default . GetString ( msgStaticTest . Properties . UserId ) ) ;
354- foreach ( var ( key , value ) in msgStaticTest . ApplicationProperties )
355- {
356- Assert . Equal ( "test" , key ) ;
357- Assert . Equal ( "test" , value ) ;
358- }
354+ Assert . Equal ( "test" , msgStaticTest . ApplicationProperties [ "test" ] ) ;
355+ Assert . Equal ( 64.646464 , msgStaticTest . ApplicationProperties [ "double" ] ) ;
359356
360357 Assert . Equal ( "test" , msgStaticTest . Annotations [ "test" ] ) ;
361358 Assert . Equal ( ( long ) 1 , msgStaticTest . Annotations [ ( long ) 1 ] ) ;
@@ -374,6 +371,76 @@ public void ValidateMessagesFromGo()
374371 Assert . Equal ( "amqpValue" , msgHeader . AmqpValue ) ;
375372 }
376373
374+ [ Fact ]
375+ public void ValidateMapsType ( )
376+ {
377+ const double DoubleValue = 6665555.34566 ;
378+ var dt = DateTime . Now ;
379+ var app = new ApplicationProperties ( )
380+ {
381+ [ "double_value" ] = DoubleValue ,
382+ [ "string_value" ] = "test" ,
383+ [ "bool_value" ] = true ,
384+ [ "byte_value" ] = ( byte ) 1 ,
385+ [ "short_value" ] = ( short ) 1 ,
386+ [ "int_value" ] = 1 ,
387+ [ "long_value" ] = 1L ,
388+ [ "ulong_value" ] = 1UL ,
389+ [ "float_value" ] = 1.0f ,
390+ [ "date_value" ] = dt
391+ } ;
392+ var m = new Message ( Encoding . Default . GetBytes ( "hello" ) ) { ApplicationProperties = app } ;
393+ Assert . NotNull ( m . ApplicationProperties ) ;
394+
395+ Assert . Equal ( 14 , AmqpWireFormatting . GetAnySize ( "string_value" ) ) ;
396+ Assert . Equal ( 9 , AmqpWireFormatting . GetAnySize ( DoubleValue ) ) ;
397+ Assert . Equal ( 1 , AmqpWireFormatting . GetAnySize ( true ) ) ;
398+ Assert . Equal ( 1 , AmqpWireFormatting . GetAnySize ( ( byte ) 1 ) ) ;
399+ Assert . Equal ( 3 , AmqpWireFormatting . GetAnySize ( ( short ) 1 ) ) ;
400+ // In this case is a byte
401+ Assert . Equal ( 2 , AmqpWireFormatting . GetAnySize ( 1 ) ) ;
402+ // In this case is a byte less than 128
403+ Assert . Equal ( 2 , AmqpWireFormatting . GetAnySize ( 1L ) ) ;
404+ // In this case is a long
405+ Assert . Equal ( 9 , AmqpWireFormatting . GetAnySize ( 1000L ) ) ;
406+
407+ // byte
408+ Assert . Equal ( 2 , AmqpWireFormatting . GetAnySize ( 1UL ) ) ;
409+ // ulong
410+ Assert . Equal ( 9 , AmqpWireFormatting . GetAnySize ( 1000UL ) ) ;
411+
412+ Assert . Equal ( 5 , AmqpWireFormatting . GetAnySize ( 1.0f ) ) ;
413+
414+ Assert . Equal ( 9 , AmqpWireFormatting . GetAnySize ( dt ) ) ;
415+
416+ var size = DescribedFormatCode . Size ;
417+ size += sizeof ( byte ) ; //FormatCode.List32
418+ size += sizeof ( uint ) ; // field numbers
419+ size += sizeof ( uint ) ; // PropertySize
420+ size += AmqpWireFormatting . GetAnySize ( "double_value" ) ;
421+ size += AmqpWireFormatting . GetAnySize ( DoubleValue ) ;
422+ size += AmqpWireFormatting . GetAnySize ( "string_value" ) ;
423+ size += AmqpWireFormatting . GetAnySize ( "test" ) ;
424+ size += AmqpWireFormatting . GetAnySize ( "bool_value" ) ;
425+ size += AmqpWireFormatting . GetAnySize ( true ) ;
426+ size += AmqpWireFormatting . GetAnySize ( "byte_value" ) ;
427+ size += AmqpWireFormatting . GetAnySize ( ( byte ) 1 ) ;
428+ size += AmqpWireFormatting . GetAnySize ( "short_value" ) ;
429+ size += AmqpWireFormatting . GetAnySize ( ( short ) 1 ) ;
430+ size += AmqpWireFormatting . GetAnySize ( "int_value" ) ;
431+ size += AmqpWireFormatting . GetAnySize ( 1 ) ;
432+ size += AmqpWireFormatting . GetAnySize ( "long_value" ) ;
433+ size += AmqpWireFormatting . GetAnySize ( 1L ) ;
434+ size += AmqpWireFormatting . GetAnySize ( "ulong_value" ) ;
435+ size += AmqpWireFormatting . GetAnySize ( 1UL ) ;
436+ size += AmqpWireFormatting . GetAnySize ( "float_value" ) ;
437+ size += AmqpWireFormatting . GetAnySize ( 1.0f ) ;
438+ size += AmqpWireFormatting . GetAnySize ( "date_value" ) ;
439+ size += AmqpWireFormatting . GetAnySize ( dt ) ;
440+
441+ Assert . Equal ( size , m . ApplicationProperties . Size ) ;
442+ }
443+
377444 [ Fact ]
378445 public void MapEntriesWithAnEmptyKeyShouldNotBeWrittenToTheWire ( )
379446 {
0 commit comments