예제 #1
0
        public void GetURIsWithQueries_NullQuery_ThrowArgumentNullException()
        {
            var service = new SdmxQueryTranslationService(apiConfigurationMock);

            Action act = () => service.GetURIsWithQueries(null);

            act.Should().Throw <ArgumentNullException>()
            .And.ParamName.Should().Be("queries");
        }
예제 #2
0
        public void GetURIsWithQueries_SingleDictionaryEntry_ReturnSingleUri()
        {
            var service = new SdmxQueryTranslationService(apiConfigurationMock);
            var queries = new CurrencyRateQuery[]
            {
                new CurrencyRateQuery("USD", "EUR", DateTime.Today),
            };

            var result = service.GetURIsWithQueries(queries);

            result.Length.Should().Be(1);
        }
예제 #3
0
        public void GetURIsWithQueries_TwoSourcesToSameTarget_ReturnSingleURI()
        {
            var service = new SdmxQueryTranslationService(apiConfigurationMock);
            var queries = new CurrencyRateQuery[]
            {
                new CurrencyRateQuery("USD", "EUR", DateTime.Today),
                new CurrencyRateQuery("RUB", "EUR", DateTime.Today),
            };

            var result = service.GetURIsWithQueries(queries);

            result.Length.Should().Be(1);
        }
예제 #4
0
        public void GetURIsWithQueries_SameStartEndDate_ReturnFormattedDateInGeneratedURI()
        {
            var service = new SdmxQueryTranslationService(apiConfigurationMock);
            var today   = DateTime.Today;
            var queries = new CurrencyRateQuery[]
            {
                new CurrencyRateQuery("USD", "EUR", today),
            };

            var result = service.GetURIsWithQueries(queries);

            result.Length.Should().Be(1);

            var todaysDateFormated = today.ToString("yyyy-MM-dd");

            result.Should().Contain(uriWithQueries => uriWithQueries.URI.Contains($"startPeriod={todaysDateFormated}&endPeriod={todaysDateFormated}"));
        }
예제 #5
0
        private IApiHandlingStrategy GetApiHandlingStrategy(ISdmxApiConfiguration apiConfiguration)
        {
            var translationService = new SdmxQueryTranslationService(apiConfiguration);

            return(new SdmxApiHandlingStrategy(translationService, mapper));
        }