using System.Net; using System.Net.Http.Json; using Xunit; namespace IntegrationTests { public class WondersApiTests : IClassFixture { private readonly CustomWebApplicationFactory _factory; public WondersApiTests(CustomWebApplicationFactory factory) { _factory = factory; } [Fact] public async Task GetAllWonders_ShouldReturnSuccess() { var client = _factory.CreateClient(); var response = await client.GetAsync("/api/wonders"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } [Fact] public async Task CreateWonder_ShouldReturnCreated() { var client = _factory.CreateClient(); var wonder = new { Name = "Pyramids", Country = "Egypt", Era = "Ancient", Type = "Monument", Description = "One of the ancient wonders", DiscoveryYear = 2560 }; var response = await client.PostAsJsonAsync("/api/wonders", wonder); Assert.Equal(HttpStatusCode.Created, response.StatusCode); } } }