1515
1616 class When_ingesting_failed_message_with_missing_headers : AcceptanceTest
1717 {
18- [ Test ]
19- public async Task TimeSent_should_not_be_casted ( )
20- {
21- FailedMessageView failure = null ;
22-
23- var sentTime = DateTime . Parse ( "2014-11-11T02:26:58.000462Z" ) ;
24-
25- await Define < MyContext > ( c =>
26- {
27- c . AddMinimalRequiredHeaders ( ) ;
28- c . Headers . Add ( "NServiceBus.TimeSent" , DateTimeOffsetHelper . ToWireFormattedString ( sentTime ) ) ;
29- } )
30- . WithEndpoint < FailingEndpoint > ( )
31- . Done ( async c =>
32- {
33- var result = await this . TryGet < FailedMessageView > ( $ "/api/errors/last/{ c . UniqueMessageId } ") ;
34- failure = result ;
35- return ( c . UniqueMessageId != null ) & result ;
36- } )
37- . Run ( ) ;
38-
39- Assert . That ( failure , Is . Not . Null ) ;
40- Assert . That ( failure . TimeSent , Is . EqualTo ( sentTime ) ) ;
41- }
42-
4318 [ Test ]
4419 public async Task Should_be_ingested_when_minimal_required_headers_is_present ( )
4520 {
@@ -66,7 +41,7 @@ await Define<MyContext>(c =>
6641 //No failure time will result in utc now being used
6742 Assert . That ( failure . TimeOfFailure , Is . GreaterThan ( testStartTime ) ) ;
6843
69- // Both host and endpoint name is currently needed so this will be null since no host can be detected from the failed q header5
44+ // Both host and endpoint name is currently needed so this will be null since no host can be detected from the failed q header
7045 Assert . That ( failure . ReceivingEndpoint , Is . Null ) ;
7146 }
7247
@@ -80,7 +55,7 @@ public async Task Should_include_headers_required_by_ServicePulse()
8055 c . AddMinimalRequiredHeaders ( ) ;
8156
8257 // This is needed for ServiceControl to be able to detect both endpoint (via failed q header) and host via the processing machine header
83- // Missing endpoint or host will case a null ref in ServicePulse
58+ // Missing endpoint or host will cause a null ref in ServicePulse
8459 c . Headers [ Headers . ProcessingMachine ] = "MyMachine" ;
8560
8661 c . Headers [ "NServiceBus.ExceptionInfo.ExceptionType" ] = "SomeExceptionType" ;
@@ -107,6 +82,31 @@ public async Task Should_include_headers_required_by_ServicePulse()
10782 Assert . That ( failure . Exception . Message , Is . EqualTo ( "Some message" ) ) ;
10883 }
10984
85+ [ Test ]
86+ public async Task TimeSent_should_not_be_casted ( )
87+ {
88+ FailedMessageView failure = null ;
89+
90+ var sentTime = DateTime . Parse ( "2014-11-11T02:26:58.000462Z" ) ;
91+
92+ await Define < MyContext > ( c =>
93+ {
94+ c . AddMinimalRequiredHeaders ( ) ;
95+ c . Headers . Add ( "NServiceBus.TimeSent" , DateTimeOffsetHelper . ToWireFormattedString ( sentTime ) ) ;
96+ } )
97+ . WithEndpoint < FailingEndpoint > ( )
98+ . Done ( async c =>
99+ {
100+ var result = await this . TryGet < FailedMessageView > ( $ "/api/errors/last/{ c . UniqueMessageId } ") ;
101+ failure = result ;
102+ return ( c . UniqueMessageId != null ) & result ;
103+ } )
104+ . Run ( ) ;
105+
106+ Assert . That ( failure , Is . Not . Null ) ;
107+ Assert . That ( failure . TimeSent , Is . EqualTo ( sentTime ) ) ;
108+ }
109+
110110 class MyContext : ScenarioContext
111111 {
112112 public string MessageId { get ; } = Guid . NewGuid ( ) . ToString ( ) ;
0 commit comments