using JdeScoping.Client.Services; using Shouldly; namespace JdeScoping.Api.IntegrationTests.ClientIntegration; public class SearchApiClientIntegrationTests : ClientIntegrationTestBase { public SearchApiClientIntegrationTests(TestWebApplicationFactory factory) : base(factory) { } [Fact] public async Task GetUserSearchesAsync_WithAuth_ReturnsSearchList() { // Arrange await LoginAsync(); // Act var result = await SearchClient.GetUserSearchesAsync(); // Assert result.IsSuccess.ShouldBeTrue(); result.Value.ShouldNotBeNull(); } [Fact] public async Task GetUserSearchesAsync_WithoutAuth_ReturnsUnauthorized() { // Arrange - use fresh client without cookies var freshClient = new SearchApiClient(CreateFreshClient()); // Act var result = await freshClient.GetUserSearchesAsync(); // Assert result.IsUnauthorized.ShouldBeTrue(); } [Fact] public async Task GetSearchAsync_NotFound_ReturnsNotFound() { // Arrange await LoginAsync(); var nonExistentId = 999999; // Act var result = await SearchClient.GetSearchAsync(nonExistentId); // Assert result.IsNotFound.ShouldBeTrue(); } }