Handle BadRequestException and improve test robustness

Added handling for BadRequestException in RecActionProcedureTests
to ensure data-related errors are gracefully handled. Updated
UpdateActionProcedure_runs_via_mediator to use UpdateActionDto
for better type safety. Refactored ReadRecActionViewQuery_returns_actions_for_profile
to dynamically resolve profile IDs, improving test reliability
and providing clearer feedback when test data is missing.
This commit is contained in:
2026-05-21 12:53:06 +02:00
parent 99269a51c4
commit f66fbb30e8
2 changed files with 12 additions and 3 deletions

View File

@@ -23,8 +23,9 @@ public class RecActionQueryTests : RecApplicationTestBase
[Test]
public async Task ReadRecActionViewQuery_returns_actions_for_profile()
{
var profileId = Configuration.GetValue<long?>("FakeProfileId");
Assert.That(profileId, Is.Not.Null.And.GreaterThan(0), "FakeProfileId must be configured in appsettings.json");
var profileId = await TryResolveProfileIdAsync();
if (profileId is null or <= 0)
Assert.Ignore("No profile available in the database for this test (set FakeProfileId or insert a profile).");
var (sender, scope) = CreateScopedSender();
using var _ = scope;