@@ -33,130 +33,61 @@ class TestingBasicProperties : IBasicProperties
3333
3434 public string ProtocolClassName => throw new NotSupportedException ( ) ;
3535
36- public void ClearAppId ( )
37- {
38- throw new NotSupportedException ( ) ;
39- }
36+ public void ClearAppId ( ) => throw new NotSupportedException ( ) ;
4037
41- public void ClearClusterId ( )
42- {
43- throw new NotSupportedException ( ) ;
44- }
38+ public void ClearClusterId ( ) => throw new NotSupportedException ( ) ;
4539
46- public void ClearContentEncoding ( )
47- {
48- throw new NotSupportedException ( ) ;
49- }
40+ public void ClearContentEncoding ( ) => throw new NotSupportedException ( ) ;
5041
51- public void ClearContentType ( )
52- {
53- throw new NotSupportedException ( ) ;
54- }
42+ public void ClearContentType ( ) => throw new NotSupportedException ( ) ;
5543
56- public void ClearCorrelationId ( )
57- {
58- throw new NotSupportedException ( ) ;
59- }
44+ public void ClearCorrelationId ( ) => throw new NotSupportedException ( ) ;
6045
61- public void ClearDeliveryMode ( )
62- {
63- throw new NotSupportedException ( ) ;
64- }
46+ public void ClearDeliveryMode ( ) => throw new NotSupportedException ( ) ;
6547
66- public void ClearExpiration ( )
67- {
68- throw new NotSupportedException ( ) ;
69- }
48+ public void ClearExpiration ( ) => throw new NotSupportedException ( ) ;
7049
71- public void ClearHeaders ( )
72- {
73- throw new NotSupportedException ( ) ;
74- }
50+ public void ClearHeaders ( ) => throw new NotSupportedException ( ) ;
7551
76- public void ClearMessageId ( )
77- {
78- throw new NotSupportedException ( ) ;
79- }
52+ public void ClearMessageId ( ) => throw new NotSupportedException ( ) ;
8053
81- public void ClearPriority ( )
82- {
83- throw new NotSupportedException ( ) ;
84- }
54+ public void ClearPriority ( ) => throw new NotSupportedException ( ) ;
8555
86- public void ClearReplyTo ( )
87- {
88- throw new NotSupportedException ( ) ;
89- }
56+ public void ClearReplyTo ( ) => throw new NotSupportedException ( ) ;
9057
91- public void ClearTimestamp ( )
92- {
93- throw new NotSupportedException ( ) ;
94- }
58+ public void ClearTimestamp ( ) => throw new NotSupportedException ( ) ;
9559
96- public void ClearType ( )
97- {
98- throw new NotSupportedException ( ) ;
99- }
60+ public void ClearType ( ) => throw new NotSupportedException ( ) ;
10061
101- public void ClearUserId ( )
102- {
103- throw new NotSupportedException ( ) ;
104- }
62+ public void ClearUserId ( ) => throw new NotSupportedException ( ) ;
10563
106- public bool IsAppIdPresent ( )
107- {
108- throw new NotSupportedException ( ) ;
109- }
64+ public bool IsAppIdPresent ( ) => throw new NotSupportedException ( ) ;
11065
111- public bool IsClusterIdPresent ( )
112- {
113- throw new NotSupportedException ( ) ;
114- }
66+ public bool IsClusterIdPresent ( ) => throw new NotSupportedException ( ) ;
11567
116- public bool IsContentEncodingPresent ( )
117- {
118- throw new NotSupportedException ( ) ;
119- }
68+ public bool IsContentEncodingPresent ( ) => throw new NotSupportedException ( ) ;
12069
121- public bool IsContentTypePresent ( )
122- {
123- throw new NotSupportedException ( ) ;
124- }
70+ public bool IsContentTypePresent ( ) => ContentType != null ;
12571
12672 public bool IsCorrelationIdPresent ( ) => ! string . IsNullOrEmpty ( CorrelationId ) ;
12773
12874 public bool IsDeliveryModePresent ( ) => DeliveryMode != 0 ;
12975
130- public bool IsExpirationPresent ( )
131- {
132- throw new NotSupportedException ( ) ;
133- }
76+ public bool IsExpirationPresent ( ) => throw new NotSupportedException ( ) ;
13477
135- public bool IsHeadersPresent ( )
136- {
137- throw new NotSupportedException ( ) ;
138- }
78+ public bool IsHeadersPresent ( ) => throw new NotSupportedException ( ) ;
13979
14080 public bool IsMessageIdPresent ( ) => ! string . IsNullOrEmpty ( MessageId ) ;
14181
142- public bool IsPriorityPresent ( )
143- {
144- throw new NotSupportedException ( ) ;
145- }
82+ public bool IsPriorityPresent ( ) => throw new NotSupportedException ( ) ;
14683
14784 public bool IsReplyToPresent ( ) => ! string . IsNullOrEmpty ( ReplyTo ) ;
14885
149- public bool IsTimestampPresent ( )
150- {
151- throw new NotSupportedException ( ) ;
152- }
86+ public bool IsTimestampPresent ( ) => throw new NotSupportedException ( ) ;
15387
15488 public bool IsTypePresent ( ) => ! string . IsNullOrEmpty ( Type ) ;
15589
156- public bool IsUserIdPresent ( )
157- {
158- throw new NotSupportedException ( ) ;
159- }
90+ public bool IsUserIdPresent ( ) => throw new NotSupportedException ( ) ;
16091 }
16192
16293 MessageConverter converter = new MessageConverter ( MessageConverter . DefaultMessageIdStrategy ) ;
@@ -403,5 +334,34 @@ public void TestCanHandleTablesListHeader()
403334 Assert . NotNull ( headers ) ;
404335 Assert . AreEqual ( "key1=value1,key2=value2" , Convert . ToString ( headers [ "Foo" ] ) ) ;
405336 }
337+
338+ [ Test ]
339+ public void Should_handle_content_type ( )
340+ {
341+ var basicProperties = new TestingBasicProperties
342+ {
343+ MessageId = "Blah" ,
344+ ContentType = "content_type"
345+ } ;
346+
347+ var message = new BasicDeliverEventArgs
348+ {
349+ BasicProperties = new TestingBasicProperties
350+ {
351+ MessageId = "Blah" ,
352+ ContentType = "content_type"
353+ }
354+ } ;
355+
356+ var headers = converter . RetrieveHeaders ( message ) ;
357+ var messageId = converter . RetrieveMessageId ( message , headers ) ;
358+
359+ Assert . Multiple ( ( ) =>
360+ {
361+ Assert . That ( messageId , Is . Not . Null ) ;
362+ Assert . That ( headers , Is . Not . Null ) ;
363+ Assert . That ( headers [ NServiceBus . Headers . ContentType ] , Is . EqualTo ( basicProperties . ContentType ) ) ;
364+ } ) ;
365+ }
406366 }
407367}
0 commit comments