Пример #1
0
    public UserSecretsFixture()
    {
        var fixture = new Helpers.XUnitClassFixtures.UserSecretsFixture();

        Config = fixture.Configuration
                 .GetSection("SSH")
                 .Get <Config>()
                 ?? throw new KeyNotFoundException();
    }
Пример #2
0
    public ConfigFixture()
    {
        var @base = new Helpers.XUnitClassFixtures.UserSecretsFixture();

        new ConfigurationBuilder()
        .AddConfiguration(@base.Configuration)
        .Build();

        var provider = new ServiceCollection()
                       .JsonConfig <Addresses>(@base.Configuration.GetSection("Elgato"))
                       .BuildServiceProvider();

        Addresses = provider.GetRequiredService <IOptions <Addresses> >().Value;
    }
Пример #3
0
    public AuthorizationClientFixture()
    {
        var userSecretsFixture = new Helpers.XUnitClassFixtures.UserSecretsFixture();

        var username = userSecretsFixture["DockerHub:Username"];
        var password = userSecretsFixture["DockerHub:Password"];

        var config = new Config(username, password);

        _httpMessageHandler = new HttpClientHandler {
            AllowAutoRedirect = false,
        };
        _httpClient = new HttpClient(_httpMessageHandler)
        {
            BaseAddress = config.AuthApiBaseAddress,
        };
        _memoryCache        = new MemoryCache(new MemoryCacheOptions());
        AuthorizationClient = new Concrete.AuthorizationClient(config, _httpClient, _memoryCache);
    }