using Microsoft.Extensions.Configuration;

namespace e_suite.UnitTestCore;

public class TestBase
{
    protected IConfiguration _configuration = null!;
    protected FakeClock _fakeClock = null!;

    public virtual Task Setup()
    {
        var appSettingsStub = new Dictionary<string, string> {
            {"applicationName", "e-suite test"},
            {"baseUrl", "https://esuite.test"},
            {"Smtp:EmailTimeoutHours", "48"},
            {"Smtp:Server", "127.0.0.1"},
            {"Smtp:Port", "25"},
            {"Smtp:FromAddress", "esuitetest@sun-strategy.com"},
            {"JwtConfig:secret", "Z8p9YKvYnwm62sPLJVdvp3M7bQ5l0UqRGwz95ZqL"},
            {"JwtConfig:expirationInMinutes", "15"},
            {"JwtConfig:audience", "test"},
            {"JwtConfig:issuer", "moq"},
            {"Sentinel:LoginAttemptTimeoutMinutes", "60"},
            {"Sentinel:MaxLoginAttempts", "5"}
        };

        _configuration = new ConfigurationBuilder()
            .AddInMemoryCollection(appSettingsStub!)
            .Build();
            
        _fakeClock = new FakeClock();

        return Task.CompletedTask;
    }
}