| using System.Net; | |
| using Microsoft.AspNetCore.Mvc.Testing; | |
| using Xunit; | |
| using FluentAssertions; | |
| namespace AiDevProject.Tests.Unit; | |
| /// <summary> | |
| /// Tests for health controller. | |
| /// </summary> | |
| public class HealthControllerTests : IClassFixture<WebApplicationFactory<Program>> | |
| { | |
| private readonly HttpClient _client; | |
| public HealthControllerTests(WebApplicationFactory<Program> factory) | |
| { | |
| _client = factory.CreateClient(); | |
| } | |
| [] | |
| public async Task GetHealth_ReturnsOk() | |
| { | |
| // Act | |
| var response = await _client.GetAsync("/api/health"); | |
| // Assert | |
| response.StatusCode.Should().Be(HttpStatusCode.OK); | |
| var content = await response.Content.ReadAsStringAsync(); | |
| content.Should().Contain("ok"); | |
| } | |
| } | |