Files
meeting-assistant/MeetingAssistant.Tests/HealthEndpointTests.cs
T
2026-05-18 23:38:47 +02:00

31 lines
905 B
C#

using System.Net;
using System.Net.Http.Json;
using Microsoft.AspNetCore.Mvc.Testing;
namespace MeetingAssistant.Tests;
public sealed class HealthEndpointTests : IClassFixture<WebApplicationFactory<Program>>
{
private readonly WebApplicationFactory<Program> factory;
public HealthEndpointTests(WebApplicationFactory<Program> factory)
{
this.factory = factory;
}
[Fact]
public async Task HealthEndpointReportsServiceStatus()
{
using var client = factory.CreateClient();
using var response = await client.GetAsync("/health");
var body = await response.Content.ReadFromJsonAsync<HealthResponse>();
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("meeting-assistant", body?.Service);
Assert.Equal("ok", body?.Status);
}
private sealed record HealthResponse(string Service, string Status);
}