@@ -37,130 +37,61 @@ class TestingBasicProperties : IBasicProperties
3737
3838 DeliveryModes IReadOnlyBasicProperties . DeliveryMode => throw new NotImplementedException ( ) ;
3939
40- public void ClearAppId ( )
41- {
42- throw new NotSupportedException ( ) ;
43- }
40+ public void ClearAppId ( ) => throw new NotSupportedException ( ) ;
4441
45- public void ClearClusterId ( )
46- {
47- throw new NotSupportedException ( ) ;
48- }
42+ public void ClearClusterId ( ) => throw new NotSupportedException ( ) ;
4943
50- public void ClearContentEncoding ( )
51- {
52- throw new NotSupportedException ( ) ;
53- }
44+ public void ClearContentEncoding ( ) => throw new NotSupportedException ( ) ;
5445
55- public void ClearContentType ( )
56- {
57- throw new NotSupportedException ( ) ;
58- }
46+ public void ClearContentType ( ) => throw new NotSupportedException ( ) ;
5947
60- public void ClearCorrelationId ( )
61- {
62- throw new NotSupportedException ( ) ;
63- }
48+ public void ClearCorrelationId ( ) => throw new NotSupportedException ( ) ;
6449
65- public void ClearDeliveryMode ( )
66- {
67- throw new NotSupportedException ( ) ;
68- }
50+ public void ClearDeliveryMode ( ) => throw new NotSupportedException ( ) ;
6951
70- public void ClearExpiration ( )
71- {
72- throw new NotSupportedException ( ) ;
73- }
52+ public void ClearExpiration ( ) => throw new NotSupportedException ( ) ;
7453
75- public void ClearHeaders ( )
76- {
77- throw new NotSupportedException ( ) ;
78- }
54+ public void ClearHeaders ( ) => throw new NotSupportedException ( ) ;
7955
80- public void ClearMessageId ( )
81- {
82- throw new NotSupportedException ( ) ;
83- }
56+ public void ClearMessageId ( ) => throw new NotSupportedException ( ) ;
8457
85- public void ClearPriority ( )
86- {
87- throw new NotSupportedException ( ) ;
88- }
58+ public void ClearPriority ( ) => throw new NotSupportedException ( ) ;
8959
90- public void ClearReplyTo ( )
91- {
92- throw new NotSupportedException ( ) ;
93- }
60+ public void ClearReplyTo ( ) => throw new NotSupportedException ( ) ;
9461
95- public void ClearTimestamp ( )
96- {
97- throw new NotSupportedException ( ) ;
98- }
62+ public void ClearTimestamp ( ) => throw new NotSupportedException ( ) ;
9963
100- public void ClearType ( )
101- {
102- throw new NotSupportedException ( ) ;
103- }
64+ public void ClearType ( ) => throw new NotSupportedException ( ) ;
10465
105- public void ClearUserId ( )
106- {
107- throw new NotSupportedException ( ) ;
108- }
66+ public void ClearUserId ( ) => throw new NotSupportedException ( ) ;
10967
110- public bool IsAppIdPresent ( )
111- {
112- throw new NotSupportedException ( ) ;
113- }
68+ public bool IsAppIdPresent ( ) => throw new NotSupportedException ( ) ;
11469
115- public bool IsClusterIdPresent ( )
116- {
117- throw new NotSupportedException ( ) ;
118- }
70+ public bool IsClusterIdPresent ( ) => throw new NotSupportedException ( ) ;
11971
120- public bool IsContentEncodingPresent ( )
121- {
122- throw new NotSupportedException ( ) ;
123- }
72+ public bool IsContentEncodingPresent ( ) => throw new NotSupportedException ( ) ;
12473
125- public bool IsContentTypePresent ( )
126- {
127- throw new NotSupportedException ( ) ;
128- }
74+ public bool IsContentTypePresent ( ) => ContentType != null ;
12975
13076 public bool IsCorrelationIdPresent ( ) => ! string . IsNullOrEmpty ( CorrelationId ) ;
13177
13278 public bool IsDeliveryModePresent ( ) => DeliveryMode != 0 ;
13379
134- public bool IsExpirationPresent ( )
135- {
136- throw new NotSupportedException ( ) ;
137- }
80+ public bool IsExpirationPresent ( ) => throw new NotSupportedException ( ) ;
13881
139- public bool IsHeadersPresent ( )
140- {
141- throw new NotSupportedException ( ) ;
142- }
82+ public bool IsHeadersPresent ( ) => throw new NotSupportedException ( ) ;
14383
14484 public bool IsMessageIdPresent ( ) => ! string . IsNullOrEmpty ( MessageId ) ;
14585
146- public bool IsPriorityPresent ( )
147- {
148- throw new NotSupportedException ( ) ;
149- }
86+ public bool IsPriorityPresent ( ) => throw new NotSupportedException ( ) ;
15087
15188 public bool IsReplyToPresent ( ) => ! string . IsNullOrEmpty ( ReplyTo ) ;
15289
153- public bool IsTimestampPresent ( )
154- {
155- throw new NotSupportedException ( ) ;
156- }
90+ public bool IsTimestampPresent ( ) => throw new NotSupportedException ( ) ;
15791
15892 public bool IsTypePresent ( ) => ! string . IsNullOrEmpty ( Type ) ;
15993
160- public bool IsUserIdPresent ( )
161- {
162- throw new NotSupportedException ( ) ;
163- }
94+ public bool IsUserIdPresent ( ) => throw new NotSupportedException ( ) ;
16495 }
16596
16697 MessageConverter converter = new MessageConverter ( MessageConverter . DefaultMessageIdStrategy ) ;
@@ -401,5 +332,27 @@ public void TestCanHandleTablesListHeader()
401332 Assert . That ( Convert . ToString ( headers [ "Foo" ] ) , Is . EqualTo ( "key1=value1,key2=value2" ) ) ;
402333 } ) ;
403334 }
335+
336+ [ Test ]
337+ public void Should_handle_content_type ( )
338+ {
339+ var basicProperties = new TestingBasicProperties
340+ {
341+ MessageId = "Blah" ,
342+ ContentType = "content_type"
343+ } ;
344+
345+ var message = new BasicDeliverEventArgs ( default , default , default , default , default , basicProperties , default ) ;
346+
347+ var headers = converter . RetrieveHeaders ( message ) ;
348+ var messageId = converter . RetrieveMessageId ( message , headers ) ;
349+
350+ Assert . Multiple ( ( ) =>
351+ {
352+ Assert . That ( messageId , Is . Not . Null ) ;
353+ Assert . That ( headers , Is . Not . Null ) ;
354+ Assert . That ( headers [ NServiceBus . Headers . ContentType ] , Is . EqualTo ( basicProperties . ContentType ) ) ;
355+ } ) ;
356+ }
404357 }
405358}
0 commit comments