using System.Net; using System.Net.Http.Json; using FluentAssertions; [Collection("Integration")] public class ValidationTests { private readonly HttpClient _client; public ValidationTests(ApiFixture fixture) => _client = fixture.CreateClient(); [Fact] public async Task EmptyFirstName_Returns400() { var resp = await _client.PostAsJsonAsync("/api/v1/patients", new { firstName = "", lastName = "Valid", dateOfBirth = "1990-01-01", gender = "M" }); resp.StatusCode.Should().Be(HttpStatusCode.BadRequest); } [Fact] public async Task ThresholdInvalidOrder_Returns400() { var resp = await _client.PostAsJsonAsync("/api/v1/alert-thresholds", new { observationCode = "TEST_CODE", displayName = "Test", unit = "units", criticalLow = 50, warningLow = 30 }); resp.StatusCode.Should().Be(HttpStatusCode.BadRequest); } [Fact] public async Task OrderEmptyDescription_Returns400() { var resp = await _client.PostAsJsonAsync( $"/api/v1/encounters/{Guid.NewGuid()}/orders", new { orderType = "Lab", description = "", orderedBy = "Dr. Test" }); resp.StatusCode.Should().Be(HttpStatusCode.BadRequest); } }