コード例 #1
0
        static void Init(CommandLineOptions options)
        {
            _httpSpiExecutionContextManager = new HttpSpiExecutionContextManager();
            _httpSpiExecutionContextManager.SetInternalRequestId(Guid.NewGuid());

            _providerRepository = new TableProviderRepository(
                new CacheConfiguration
            {
                TableStorageConnectionString = options.TableStorageConnectionString,
                ProviderTableName            = options.ProviderTableName,
            },
                _logger);

            var translator = new TranslatorApiClient(
                new AuthenticationConfiguration()
            {
                ClientId      = options.ClientId,
                ClientSecret  = options.ClientSecret,
                Resource      = options.Resource,
                TokenEndpoint = options.TokenEndpoint,
            },
                new RestClient(),
                new CacheProvider(),
                new TranslatorConfiguration
            {
                BaseUrl         = options.TranslatorBaseUrl,
                SubscriptionKey = options.TranslatorSubscriptionKey,
            },
                _logger,
                _httpSpiExecutionContextManager);

            _mapper = new PocoMapper(translator);
        }
コード例 #2
0
        public void Arrange()
        {
            _authenticationConfiguration = new AuthenticationConfiguration()
            {
                ClientId      = "some client id",
                ClientSecret  = "some secret",
                Resource      = "http://some.fake.url/abc123",
                TokenEndpoint = "https://somecorp.local/tokens",
            };

            _restClientMock = new Mock <IRestClient>();
            _restClientMock.Setup(c => c.ExecuteTaskAsync(It.IsAny <IRestRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new RestResponse
            {
                StatusCode     = HttpStatusCode.NotFound,
                ResponseStatus = ResponseStatus.Completed,
            });

            _cacheProviderMock = new Mock <ICacheProvider>();

            _configuration = new TranslatorConfiguration
            {
                BaseUrl = "https://translator.unit.tests",
            };

            _loggerMock = new Mock <ILoggerWrapper>();

            _spiExecutionContextManagerMock = new Mock <ISpiExecutionContextManager>();
            _spiExecutionContextManagerMock.Setup(x => x.SpiExecutionContext)
            .Returns(new SpiExecutionContext());

            _translator = new TranslatorApiClient(
                _authenticationConfiguration,
                _restClientMock.Object,
                _cacheProviderMock.Object,
                _configuration,
                _loggerMock.Object,
                _spiExecutionContextManagerMock.Object);

            _cancellationToken = new CancellationToken();
        }
コード例 #3
0
        static void Init(CommandLineOptions options)
        {
            _giasApiClient = new GiasSoapApiClient(new GiasApiConfiguration
            {
                Url       = options.GiasUrl,
                Username  = options.GiasUsername,
                Password  = options.GiasPassword,
                ExtractId = options.GiasExtractId,
                ExtractEstablishmentsFileName = "Eapim_Daily_Download.csv",
                ExtractGroupsFileName         = "groups.csv",
                ExtractGroupLinksFileName     = "groupLinks.csv",
            });

            _httpSpiExecutionContextManager = new HttpSpiExecutionContextManager();
            _httpSpiExecutionContextManager.SetInternalRequestId(Guid.NewGuid());

            var translator = new TranslatorApiClient(
                new AuthenticationConfiguration()
            {
                ClientId      = options.ClientId,
                ClientSecret  = options.ClientSecret,
                Resource      = options.Resource,
                TokenEndpoint = options.TokenEndpoint,
            },
                new RestClient(),
                new CacheProvider(),
                _httpSpiExecutionContextManager,
                new TranslatorConfiguration
            {
                BaseUrl         = options.TranslatorBaseUrl,
                SubscriptionKey = options.TranslatorSubscriptionKey,
            },
                _logger);

            _groupRepository = new InProcGroupRepository();

            _localAuthorityRepository = new InProcLocalAuthorityRepository();

            _mapper = new PocoMapper(translator, _groupRepository, _localAuthorityRepository);
        }