Пример #1
0
        public ShrimpyApiFixture()
        {
            var secrets       = new Secrets();
            var configuration = new ShrimpyApiConfiguration
            {
                ApiKey    = secrets.ShrimpyApiKey,
                ApiSecret = secrets.ShrimpyApiSecret,
                BaseUrl   = "https://api.shrimpy.io"
            };

            var devSecrets = new SecretsDev();
            var devConfig  = new ShrimpyDevApiConfiguration
            {
                ApiKey    = devSecrets.ShrimpyApiKey,
                ApiSecret = devSecrets.ShrimpyApiSecret,
                BaseUrl   = "https://dev-api.shrimpy.io"
            };

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddCoreDependencies();
            serviceCollection.AddApiCredentialsProvider <ShrimpyDevApiConfiguration>();
            serviceCollection.AddApiCredentialsProvider <ShrimpyApiConfiguration>();

            serviceCollection.AddShrimpyClients(configuration);
            serviceCollection.AddShrimpyDeveloperClients(devConfig);
            ServiceProvider = serviceCollection.BuildServiceProvider();
        }
Пример #2
0
        public static IServiceCollection AddShrimpyDeveloperClients(
            this IServiceCollection serviceCollection, ShrimpyDevApiConfiguration apiConfiguration)
        {
            serviceCollection.AddApiCredentialsProvider <ShrimpyDevApiConfiguration>();
            var options = Options.Create(apiConfiguration);

            serviceCollection.AddSingleton(options);
            serviceCollection.AddSingleton(s => new ClientConfigurator(s));
            AddClients(serviceCollection);
            return(serviceCollection);
        }