Пример #1
0
        public async void CanGetReleaseSeriesAsync()
        {
            const string response   = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<seriess realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""series_id"" sort_order=""asc"" count=""4400"" offset=""0"" limit=""1000"">
  <series id=""CPIAPPNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Apparel"" observation_start=""1914-12-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:56:19-05"" popularity=""45""/>
  <series id=""CPIAPPSL"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Apparel"" observation_start=""1947-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-13 09:03:50-05"" popularity=""38""/>
  <series id=""CPIAUCNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: All Items"" observation_start=""1913-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:53:00-05"" popularity=""78"" notes=""Handbook of Methods - (http://www.bls.gov/opub/hom/pdf/homch17.pdf) Understanding the CPI: Frequently Asked Questions - (http://stats.bls.gov:80/cpi/cpifaq.htm)""/>
  <series id=""CPIAUCSL"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: All Items"" observation_start=""1947-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-13 08:49:51-05"" popularity=""100"" notes=""Handbook of Methods - (http://www.bls.gov/opub/hom/pdf/homch17.pdf) Understanding the CPI: Frequently Asked Questions - (http://stats.bls.gov:80/cpi/cpifaq.htm)""/>
  <series id=""CPIEDUNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Education &amp; Communication"" observation_start=""1993-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index December 1997=100"" units_short=""Index Dec 1997=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:55:23-05"" popularity=""18""/>
</seriess>";
            var          downloader = new MockDownloader(response);
            var          fred       = new Fred("key", downloader);
            var          series     = await fred.GetReleaseSeriesAsync(10);

            var expectedUrl = "http://api.stlouisfed.org/fred/release/series?api_key=key&release_id=10" + RealtimeNow + "&limit=1000&offset=0&order_by=series_id&sort_order=asc&filter_variable=&filter_value=";

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(5, series.Count());
        }
Пример #2
0
        public async void CanGetReleaseSeriesAsync()
        {
            const string response = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<seriess realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""series_id"" sort_order=""asc"" count=""4400"" offset=""0"" limit=""1000"">
  <series id=""CPIAPPNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Apparel"" observation_start=""1914-12-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:56:19-05"" popularity=""45""/>
  <series id=""CPIAPPSL"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Apparel"" observation_start=""1947-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-13 09:03:50-05"" popularity=""38""/>
  <series id=""CPIAUCNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: All Items"" observation_start=""1913-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:53:00-05"" popularity=""78"" notes=""Handbook of Methods - (http://www.bls.gov/opub/hom/pdf/homch17.pdf) Understanding the CPI: Frequently Asked Questions - (http://stats.bls.gov:80/cpi/cpifaq.htm)""/>
  <series id=""CPIAUCSL"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: All Items"" observation_start=""1947-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index 1982-84=100"" units_short=""Index 1982-84=100"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-13 08:49:51-05"" popularity=""100"" notes=""Handbook of Methods - (http://www.bls.gov/opub/hom/pdf/homch17.pdf) Understanding the CPI: Frequently Asked Questions - (http://stats.bls.gov:80/cpi/cpifaq.htm)""/>
  <series id=""CPIEDUNS"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Consumer Price Index for All Urban Consumers: Education &amp; Communication"" observation_start=""1993-01-01"" observation_end=""2012-03-01"" frequency=""Monthly"" frequency_short=""M"" units=""Index December 1997=100"" units_short=""Index Dec 1997=100"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-13 08:55:23-05"" popularity=""18""/>
</seriess>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var series = await fred.GetReleaseSeriesAsync(10);
            var expectedUrl = "http://api.stlouisfed.org/fred/release/series?api_key=key&release_id=10" + RealtimeNow + "&limit=1000&offset=0&order_by=series_id&sort_order=asc&filter_variable=&filter_value=";
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(5, series.Count());
        }