Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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}"));
        }