Skip to content

Commit 59050c3

Browse files
committed
Improve assertions
1 parent 6c9622f commit 59050c3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/ServiceControl.AcceptanceTests/Recoverability/MessageFailures/When_ingesting_failed_message_with_missing_headers.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public async Task Should_be_ingested_when_minimal_required_headers_is_present()
4545
{
4646
FailedMessageView failure = null;
4747

48+
var testStartTime = DateTime.UtcNow;
49+
4850
await Define<MyContext>(c =>
4951
{
5052
c.AddMinimalRequiredHeaders();
@@ -60,15 +62,19 @@ await Define<MyContext>(c =>
6062

6163
Assert.That(failure, Is.Not.Null);
6264
Assert.That(failure.TimeSent, Is.Null);
65+
66+
//No failure time will result in utc now being used
67+
Assert.That(failure.TimeOfFailure, Is.GreaterThan(testStartTime));
68+
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
70+
Assert.That(failure.ReceivingEndpoint, Is.Null);
6371
}
6472

6573
[Test]
6674
public async Task Should_include_headers_required_by_ServicePulse()
6775
{
6876
FailedMessageView failure = null;
6977

70-
var testStartTime = DateTime.UtcNow;
71-
7278
var context = await Define<MyContext>(c =>
7379
{
7480
c.AddMinimalRequiredHeaders();
@@ -91,9 +97,6 @@ public async Task Should_include_headers_required_by_ServicePulse()
9197

9298
Assert.That(failure, Is.Not.Null);
9399

94-
//No failure time will result in utc now being used
95-
Assert.That(failure.TimeOfFailure, Is.GreaterThan(testStartTime));
96-
97100
// ServicePulse assumes that the receiving endpoint name is present
98101
Assert.That(failure.ReceivingEndpoint, Is.Not.Null);
99102
Assert.That(failure.ReceivingEndpoint.Name, Is.EqualTo(context.EndpointNameOfReceivingEndpoint));

0 commit comments

Comments
 (0)