Esempio n. 1
0
        public void CanGetCategorySeries()
        {
            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=""2"" offset=""0"" limit=""1000"">
  <series id=""BUSINV"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Inventories: Total Business"" observation_start=""1992-01-01"" observation_end=""2012-02-01"" frequency=""Monthly, End of Period"" frequency_short=""M"" units=""Millions of Dollars, End of Period"" units_short=""Mil. of $, End of Period"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-16 09:46:03-05"" popularity=""62"" notes=""Effective June 14, 2001, data were reconstructed to reflect the switch from the Standard Industrial Classification (SIC) system to the North American Industry Classification System (NAICS).""/>
  <series id=""ISRATIO"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Inventory to Sales Ratio: Total Business"" observation_start=""1992-01-01"" observation_end=""2012-02-01"" frequency=""Monthly"" frequency_short=""M"" units=""Ratio"" units_short=""Ratio"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-16 09:46:03-05"" popularity=""69"" notes=""Effective June 14, 2001, data were reconstructed to reflect the switch from the Standard Industrial Classification (SIC) system to the North American Industry Classification System (NAICS).""/>
</seriess>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var series = fred.GetCategorySeries(1);
            var expectedUrl ="http://api.stlouisfed.org/fred/category/series?api_key=key&category_id=1" + RealtimeNow + "&limit=1000&offset=0&order_by=series_id&sort_order=asc&filter_variable=&filter_value=";
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(2, series.Count());
        }
Esempio n. 2
0
        public void CanGetCategorySeries()
        {
            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=""2"" offset=""0"" limit=""1000"">
  <series id=""BUSINV"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Inventories: Total Business"" observation_start=""1992-01-01"" observation_end=""2012-02-01"" frequency=""Monthly, End of Period"" frequency_short=""M"" units=""Millions of Dollars, End of Period"" units_short=""Mil. of $, End of Period"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-16 09:46:03-05"" popularity=""62"" notes=""Effective June 14, 2001, data were reconstructed to reflect the switch from the Standard Industrial Classification (SIC) system to the North American Industry Classification System (NAICS).""/>
  <series id=""ISRATIO"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""Inventory to Sales Ratio: Total Business"" observation_start=""1992-01-01"" observation_end=""2012-02-01"" frequency=""Monthly"" frequency_short=""M"" units=""Ratio"" units_short=""Ratio"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2012-04-16 09:46:03-05"" popularity=""69"" notes=""Effective June 14, 2001, data were reconstructed to reflect the switch from the Standard Industrial Classification (SIC) system to the North American Industry Classification System (NAICS).""/>
</seriess>";
            var          downloader  = new MockDownloader(response);
            var          fred        = new Fred("key", downloader);
            var          series      = fred.GetCategorySeries(1);
            var          expectedUrl = "http://api.stlouisfed.org/fred/category/series?api_key=key&category_id=1" + RealtimeNow + "&limit=1000&offset=0&order_by=series_id&sort_order=asc&filter_variable=&filter_value=";

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(2, series.Count());
        }