Exemplo n.º 1
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            var httpClient = HttpClientUtils.CreateClient(sessionManager.Certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, _baseUrl, httpClient, apiExecutor }));
        }
Exemplo n.º 2
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            var configuration = new Configuration();

            configuration.BasePath = _baseUrl;
            configuration.ApiClient.RestClient.HttpClientFactory = new Internal.ClientAuthHttpClientFactory(sessionManager.Certificate);

            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, configuration, apiExecutor }));
        }
Exemplo n.º 3
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            var apiClient = new ApiClient(_baseUrl)
            {
                RestClient =
                {
                    ClientCertificates = new X509Certificate2Collection
                    {
                        sessionManager.Certificate
                    }
                }
            };
            var configuration = new Configuration(apiClient);

            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, configuration, apiExecutor }));
        }
 public RetryStrategyApiExecutorTest()
 {
     _retryStrategyMock        = new Mock <IRetryStrategy>();
     _retryStrategyApiExecutor = new RetryStrategyApiExecutor(_retryStrategyMock.Object);
 }