Пример #1
0
        public void CanSearchSeries()
        {
            const string response    = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<seriess realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""search_rank"" sort_order=""asc"" count=""145"" offset=""0"" limit=""1000"">
<series id=""MYAGM4MXM189N"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M4 for Mexico"" observation_start=""1985-12-01"" observation_end=""2012-01-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-02 16:33:55-05"" popularity=""0"" notes=""M4 comprises M3 plus deposits of residents and nonresidents in branches abroad of domestic other depository corporations.""/>
<series id=""MAM1A1ZAM189N"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M1, Alternate Definition 1 for South Africa"" observation_start=""1979-03-01"" observation_end=""2012-01-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-02 16:35:45-05"" popularity=""0"" notes=""Notes regarding this series can be found in International Financial Statistics Yearbooks produced by the International Monetary Fund (IMF). We have requested these publications from the IMF. Notes on this series will populate once they become available.""/>
<series id=""MAM1A3CAM189S"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M1, Alternate Definition 3 for Canada"" observation_start=""1968-01-01"" observation_end=""2011-08-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2011-11-17 08:01:27-06"" popularity=""0"" notes=""Notes regarding this series can be found in International Financial Statistics Yearbooks produced by the International Monetary Fund (IMF). We have requested these publications from the IMF. Notes on this series will populate once they become available.""/>
</seriess>";
            var          downloader  = new MockDownloader(response);
            var          fred        = new Fred("key", downloader);
            var          series      = fred.GetSeriesSearch("money stock");
            var          expectedUrl = "http://api.stlouisfed.org/fred/series/search?api_key=key" + RealtimeNow + "&limit=1000&offset=0&order_by=search_rank&sort_order=asc&filter_variable=&filter_value=&search_type=full_text&search_text=money%20stock";

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(3, series.Count());
        }
Пример #2
0
        public void CanSearchSeries()
        {
            const string response =@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<seriess realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""search_rank"" sort_order=""asc"" count=""145"" offset=""0"" limit=""1000"">
<series id=""MYAGM4MXM189N"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M4 for Mexico"" observation_start=""1985-12-01"" observation_end=""2012-01-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-02 16:33:55-05"" popularity=""0"" notes=""M4 comprises M3 plus deposits of residents and nonresidents in branches abroad of domestic other depository corporations.""/>
<series id=""MAM1A1ZAM189N"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M1, Alternate Definition 1 for South Africa"" observation_start=""1979-03-01"" observation_end=""2012-01-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Not Seasonally Adjusted"" seasonal_adjustment_short=""NSA"" last_updated=""2012-04-02 16:35:45-05"" popularity=""0"" notes=""Notes regarding this series can be found in International Financial Statistics Yearbooks produced by the International Monetary Fund (IMF). We have requested these publications from the IMF. Notes on this series will populate once they become available.""/>
<series id=""MAM1A3CAM189S"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" title=""M1, Alternate Definition 3 for Canada"" observation_start=""1968-01-01"" observation_end=""2011-08-01"" frequency=""Monthly"" frequency_short=""M"" units=""National Currency"" units_short=""National Currency"" seasonal_adjustment=""Seasonally Adjusted"" seasonal_adjustment_short=""SA"" last_updated=""2011-11-17 08:01:27-06"" popularity=""0"" notes=""Notes regarding this series can be found in International Financial Statistics Yearbooks produced by the International Monetary Fund (IMF). We have requested these publications from the IMF. Notes on this series will populate once they become available.""/>
</seriess>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var series = fred.GetSeriesSearch("money stock");
            var expectedUrl = "http://api.stlouisfed.org/fred/series/search?api_key=key" + RealtimeNow + "&limit=1000&offset=0&order_by=search_rank&sort_order=asc&filter_variable=&filter_value=&search_type=full_text&search_text=money%20stock";
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(3, series.Count());
        }