.net 8 with xunit. How can i share a unit of IConfiguration and access it on all the tests?

I'm trying this but it doesnt work:

using EntitiesModel;
using GuestAPI.Services;
using GuestAPI.Services.Background;
using GuestAPI.Tests.Helpers.Models;
using GuestCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Configuration;

namespace GuestAPI.Tests;

public class GuestAPIWebApplicationFactory : WebApplicationFactory<Program>, IAsyncDisposable
{

    // Ensure thread-safe configuration
    private static readonly Lazy<IConfiguration> _configuration = new(GetConfiguration);

    protected override void ConfigureWebHost(IWebHostBuilder builder)
    {
        builder.ConfigureTestServices(services =>
        {
            services.RemoveAll<TimeRegistrationService>();
            services.RemoveAll<DbContextOptions<GuestDataContext>>();
            services.RemoveAll<CleanupBackgroundService>();

            services.AddScoped<TimeRegistrationService>();
            
            services.ConfigureSqlContext(_configuration.Value);
        });
    }

    public static IConfiguration GetConfiguration()
    {
        var configuration = new ConfigurationBuilder()
            .AddJsonFile("appsettings.json", optional: false)
            .AddJsonFile("appsettings.test.json", optional: true)
            //.AddUserSecrets<GuestAPIWebApplicationFactory>()
            .Build();

        return configuration;
    }

    public static TestAuthSettings GetAuthSettings()
    {
        var config = _configuration.Value;
        var authSettings = new TestAuthSettings();
        config.GetSection("TestAuth").Bind(authSettings);

        //authSettings.Username is null here

        return authSettings;
    }

    public static IConfiguration GetAppSettings()
    {
        var config = _configuration.Value;

        return config;
    }

    public override async ValueTask DisposeAsync()
    {
        await base.DisposeAsync();
    }
}

using Contracts.Repository;
using EntitiesModel.Models.AuxiliaryModels;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GuestAPI.Tests.Helpers;

public abstract class AuthenticatedTestBase : IAsyncLifetime
{
    private GuestAPIWebApplicationFactory? _factory;
    private HttpClient? _client;
    private TokenApi? _authToken;
    private IConfiguration? _configuration;

    protected GuestAPIWebApplicationFactory Factory => _factory ?? throw new InvalidOperationException("Factory not initialized");
    protected HttpClient Client => _client ?? throw new InvalidOperationException("Client not initialized");
    protected TokenApi? AuthToken => _authToken;

    public async Task InitializeAsync()
    {
        // Create new instances for each test
        _factory = new GuestAPIWebApplicationFactory();
        _client = _factory.CreateClient();

        var authSettings = GuestAPIWebApplicationFactory.GetAuthSettings();
        _configuration = GuestAPIWebApplicationFactory.GetConfiguration()!;
        var response = await _client.PostAsync(
            $"users/login?Username={authSettings.Username}&Password={authSettings.Password}",
            null);

        response.EnsureSuccessStatusCode();
        var contentString = await response.Content.ReadAsStringAsync();
        _authToken = TestSerializer.Deserialize<TokenApi>(contentString);
    }

    public async Task DisposeAsync()
    {
        if (_client != null)
        {
            _client.Dispose();
            _client = null;
        }

        if (_factory != null)
        {
            await _factory.DisposeAsync();
            _factory = null;
        }

        _authToken = null;

        _configuration = null;
    }

    protected async Task<HttpResponseMessage> SendAuthenticatedRequestAsync(
        HttpMethod method,
        string uri,
        HttpContent? content = null)
    {
        var request = new HttpRequestMessage(method, uri);
        if (content != null)
            request.Content = content;

        request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
            "Bearer",
            AuthToken?.AccessToken);

        return await Client.SendAsync(request);
    }

    protected IConfiguration GetConfiguration() { 
        
        return _configuration!;
    }
}

using EntitiesModel.Models.Response;
using GuestAPI.Tests.Helpers;
using Shouldly;

namespace GuestAPI.Tests;


public class ConfigTests : AuthenticatedTestBase
{

    private string DefaultCenterCode = GetConfiguration();

    [Fact]
    public async Task Get_RoomTypes_List()
    {
        // Token is already available via the base class
        var response = await SendAuthenticatedRequestAsync(HttpMethod.Get, "config/roomtypes");



        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {

            var stringresp = await response.Content.ReadAsStringAsync();
            var roomtypesList = TestSerializer.Deserialize<List<RoomTypesResponse>>(stringresp);

            //Assert
            roomtypesList.ShouldNotBeNull().ShouldNotBeEmpty();
            roomtypesList.Exists(r => string.IsNullOrWhiteSpace(r.Code)).ShouldNotBe(true, "There shouldn't be roomtypes with empty codes");
        }
    }


    [Fact]
    public async Task Get_RoomTypesXCenter_List()
    {

        // Token is already available via the base class
        var response = await SendAuthenticatedRequestAsync(HttpMethod.Get, $"config/roomtypesxcenter?CenterCode={DefaultCenterCode}");

        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var roomtypesXCenterList = TestSerializer.Deserialize<List<RoomTypesCenterResponse>>(stringresp);

            //Assert
            roomtypesXCenterList.ShouldNotBeNull().ShouldNotBeEmpty();
        }
    }

    #region ROOMS

    [Fact]
    public async Task Get_Room_List()
    {

        // Token is already available via the base class
        var response = await SendAuthenticatedRequestAsync(HttpMethod.Get, $"config/rooms?CenterCode={DefaultCenterCode}");

        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {

            var stringresp = await response.Content.ReadAsStringAsync();
            var roomsList = TestSerializer.Deserialize<List<RoomTypesCenterResponse>>(stringresp);

            //Assert
            roomsList.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }


    // Example of a more data-driven approach
    [Theory]
    [InlineData("Real", true)]
    [InlineData("Real", false)]
    [InlineData("Virtual", true)]
    [InlineData("Virtual", false)]
    [InlineData("Cleaned", true)]
    [InlineData("Cleaned", false)]
    [InlineData("Locked", true)]
    [InlineData("Locked", false)]
    public async Task Room_Filtering_Works_Correctly(string filterType, bool filterValue)
    {
        // Arrange
        bool expectedValue = filterValue;

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/rooms?CenterCode={DefaultCenterCode}&{filterType}={filterValue.ToString().ToLower()}");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var roomsResponses = TestSerializer.Deserialize<List<RoomsResponse>>(stringresp);
            roomsResponses.ShouldNotBeNull().ShouldNotBeEmpty();

            // More concise validation using reflection
            var property = typeof(RoomsResponse).GetProperty(filterType);
            roomsResponses.ShouldAllBe(r => (bool)property.GetValue(r) == expectedValue,
                $"All rooms should have {filterType} = {expectedValue}");
        }

    }
    #endregion

    #region RRHH

    [Fact]
    public async Task Get_RRHHDepartments_List()
    {

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/RRHH/departments");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var reasonsResponses = TestSerializer.Deserialize<List<DepartmentsResponse>>(stringresp);
            reasonsResponses.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }

    [Fact]
    public async Task Get_ContractTypes_List()
    {

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/RRHH/contracttypes");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var reasonsResponses = TestSerializer.Deserialize<List<RRHH_ContractTypeResponse>>(stringresp);
            reasonsResponses.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }

    [Fact]
    public async Task Get_ContractPositions_List()
    {

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/RRHH/positions");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var reasonsResponses = TestSerializer.Deserialize<List<RRHH_PositionsResponse>>(stringresp);
            reasonsResponses.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }

    [Fact]
    public async Task Get_IncidenceTypes_List()
    {

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/RRHH/incidencetypes");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var reasonsResponses = TestSerializer.Deserialize<List<RRHH_IncidenceTypesResponse>>(stringresp);
            reasonsResponses.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }


    [Fact]
    public async Task Get_FinishContractReason_List()
    {

        // Act
        var response = await SendAuthenticatedRequestAsync(
            HttpMethod.Get,
            $"config/RRHH/finishcontractreasons");

        // Assert
        response.EnsureSuccessStatusCode();

        if (response.StatusCode == System.Net.HttpStatusCode.OK)
        {
            var stringresp = await response.Content.ReadAsStringAsync();
            var reasonsResponses = TestSerializer.Deserialize<List<RRHH_FinishContractReasonResponse>>(stringresp);
            reasonsResponses.ShouldNotBeNull().ShouldNotBeEmpty();
        }

    }

    #endregion
}