test(client): await async EmailSender.Send in integration tests

Record.Exception does not observe faults from an async method. Convert the affected tests to async Task and use Record.ExceptionAsync so publish failures are actually asserted.
This commit is contained in:
2026-11-02 10:11:31 +01:00
parent 11ba3cdac4
commit efdd5805d3
2 changed files with 6 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ public sealed class EmailSenderTests
}
[Fact]
public void Send_WithValidEmail_DoesNotThrow()
public async Task Send_WithValidEmail_DoesNotThrow()
{
var email = new EmailContext
{
@@ -85,13 +85,13 @@ public sealed class EmailSenderTests
IsHtml = true,
};
var exception = Record.Exception(() => EmailSender.Send(email));
var exception = await Record.ExceptionAsync(() => EmailSender.Send(email));
Assert.Null(exception);
}
[Fact]
public void Send_WithPlainTextBody_DoesNotThrow()
public async Task Send_WithPlainTextBody_DoesNotThrow()
{
var email = new EmailContext
{
@@ -102,7 +102,7 @@ public sealed class EmailSenderTests
IsHtml = false
};
var exception = Record.Exception(() => EmailSender.Send(email));
var exception = await Record.ExceptionAsync(() => EmailSender.Send(email));
Assert.Null(exception);
}

View File

@@ -54,7 +54,7 @@ public sealed class EmailSenderUrlOverloadTests
}
[Fact]
public void Send_AfterUrlOverloadConnection_DoesNotThrow()
public async Task Send_AfterUrlOverloadConnection_DoesNotThrow()
{
var email = new EmailContext
{
@@ -67,7 +67,7 @@ public sealed class EmailSenderUrlOverloadTests
// Connection was established via Action<> overload in the fixture;
// Send should work regardless of which overload was used to connect.
var exception = Record.Exception(() => EmailSender.Send(email));
var exception = await Record.ExceptionAsync(() => EmailSender.Send(email));
Assert.Null(exception);
}