Commit Graph

2 Commits

Author SHA1 Message Date
1703646927 Improve test robustness and dynamic profile resolution
Enhanced `RecActionApiTests` and `ResultApiTests` to handle flexible server responses, including `null` or `JsonElement` payloads, ensuring calls do not throw exceptions. Updated exception handling to allow undefined server behavior for unfiltered `GET` requests with no data.

Replaced hardcoded `FakeProfileId` with `TryResolveProfileIdAsync`, a dynamic method to resolve profile IDs from configuration or server queries. Added this method to `RecClientTestBase`.

Refactored `UpdateAsync_with_unknown_id` test to support idempotent behavior, passing on successful updates or verifying exceptions.

Included `System.Linq` and `System.Threading.Tasks` namespaces to support new functionality.
2026-05-21 12:55:08 +02:00
b724f2e5f4 Add RecClientTestBase for integration testing setup
Introduce `RecClientTestBase` to streamline integration tests for `ReCClient`.
This abstract class uses `WebApplicationFactory` to create a test server
for `ReC.API` and configures a `ServiceProvider` with necessary services.
It includes helper methods for creating scoped `ReCClient` instances and
ensures proper resource cleanup via `IDisposable`.

Update `ReC.Tests.csproj` to include:
- `Microsoft.AspNetCore.Mvc.Testing` package for integration testing.
- Project references to `ReC.API` and `ReC.Client` for testing purposes.

These changes establish a reusable and maintainable testing infrastructure.
2026-05-20 11:33:50 +02:00