## ADDED Requirements ### Requirement: API test project exists An xUnit test project SHALL exist at `tests/ChatAgent.Api.Tests/` targeting the API project, with xUnit, Moq, and Microsoft.AspNetCore.Mvc.Testing as dependencies. #### Scenario: API tests run - **WHEN** `dotnet test` is run from the solution root - **THEN** API tests are discovered and executed ### Requirement: Client test project exists An xUnit test project SHALL exist at `tests/ChatAgent.Client.Tests/` targeting the Client services, with xUnit and Moq as dependencies. #### Scenario: Client tests run - **WHEN** `dotnet test` is run from the solution root - **THEN** Client service tests are discovered and executed ### Requirement: HealthController test coverage Tests SHALL verify that GET /api/health returns HTTP 200 with a valid HealthResponse containing a non-empty Status and a recent Timestamp. #### Scenario: Health endpoint returns 200 - **WHEN** a GET request is sent to /api/health - **THEN** the response status is 200 and the body contains `status: "healthy"` and a UTC timestamp ### Requirement: ChatController test coverage Tests SHALL verify that POST /api/chat returns a streaming SSE response containing text deltas and a [DONE] terminator. Tests SHALL mock the upstream Responses API. #### Scenario: Chat streams text deltas - **WHEN** a POST is sent to /api/chat with a valid ChatRequest - **THEN** the response is `text/event-stream` containing `data: {"text":"..."}` events followed by `data: [DONE]` #### Scenario: Chat handles upstream error - **WHEN** the Responses API is unreachable or returns an error - **THEN** the response contains a `data: {"error":"..."}` event followed by `data: [DONE]` ### Requirement: ChatApiClient test coverage Tests SHALL verify that SendChatStreamingAsync correctly parses SSE events from the backend into text deltas, handles [DONE], and throws on error events. #### Scenario: Client parses text deltas - **WHEN** the backend returns SSE events with text deltas - **THEN** SendChatStreamingAsync yields each text fragment in order #### Scenario: Client handles error event - **WHEN** the backend returns an error SSE event - **THEN** SendChatStreamingAsync throws HttpRequestException with the error message