using System.Net; using System.Net.Http.Json; using ChatAgent.Shared.Models; using Microsoft.AspNetCore.Mvc.Testing; namespace ChatAgent.Api.Tests; public class HealthControllerTests : IClassFixture> { private readonly HttpClient _client; public HealthControllerTests(WebApplicationFactory factory) { _client = factory.CreateClient(); } [Fact] public async Task GetHealth_Returns200_WithValidHealthResponse() { var response = await _client.GetAsync("/api/health"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); var health = await response.Content.ReadFromJsonAsync(); Assert.NotNull(health); Assert.Equal("healthy", health.Status); Assert.True(health.Timestamp > DateTime.MinValue); } }