Create ChatAgent.Api.Tests and ChatAgent.Client.Tests projects with xUnit and Moq. Test HealthController (200 + valid response), ChatController (SSE streaming with mocked upstream, error handling), and ChatApiClient (delta parsing, error events, health endpoint). 6 tests, all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
1.1 KiB
Markdown
24 lines
1.1 KiB
Markdown
## 1. Test Project Setup
|
|
|
|
- [x] 1.1 Create xUnit test project at tests/ChatAgent.Api.Tests with xUnit, Moq, Microsoft.AspNetCore.Mvc.Testing
|
|
- [x] 1.2 Create xUnit test project at tests/ChatAgent.Client.Tests with xUnit, Moq
|
|
- [x] 1.3 Add both test projects to ChatAgent.sln under a tests solution folder
|
|
- [x] 1.4 Make Api's Program class accessible to tests (public partial class Program)
|
|
|
|
## 2. API Tests
|
|
|
|
- [x] 2.1 Test HealthController: GET /api/health returns 200 with valid HealthResponse
|
|
- [x] 2.2 Test ChatController: POST /api/chat streams SSE text deltas from mocked upstream
|
|
- [x] 2.3 Test ChatController: POST /api/chat handles upstream error gracefully
|
|
|
|
## 3. Client Service Tests
|
|
|
|
- [x] 3.1 Create SSE response helper for building mock SSE streams
|
|
- [x] 3.2 Test ChatApiClient.SendChatStreamingAsync: parses text deltas in order
|
|
- [x] 3.3 Test ChatApiClient.SendChatStreamingAsync: throws on error event
|
|
- [x] 3.4 Test ChatApiClient.GetHealthAsync: returns HealthResponse on success
|
|
|
|
## 4. Verify
|
|
|
|
- [x] 4.1 Run dotnet test from solution root — all tests pass
|