Пример #1
0
        public void CanGetSources()
        {
            const string response    = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<sources realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""source_id"" sort_order=""asc"" count=""39"" offset=""0"" limit=""1000"">
  <source id=""1"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Board of Governors of the Federal Reserve System"" link=""http://www.federalreserve.gov/""/>
  <source id=""3"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Reserve Bank of Philadelphia"" link=""http://www.philadelphiafed.org/""/>
  <source id=""4"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Reserve Bank of St. Louis"" link=""http://www.stlouisfed.org/""/>
  <source id=""6"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Financial Institutions Examination Council"" link=""http://www.ffiec.gov/""/>
  <source id=""11"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Dow Jones &amp; Company"" link=""http://www.dowjones.com""/>
  <source id=""13"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Institute for Supply Management"" link=""http://www.ism.ws/""/>
  <source id=""14"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Thomson Reuters/University of Michigan"" link=""https://customers.reuters.com/community/university/default.aspx""/>
</sources>";
            var          downloader  = new MockDownloader(response);
            var          fred        = new Fred("key", downloader);
            var          sources     = fred.GetSources();
            var          expectedUrl = "http://api.stlouisfed.org/fred/sources?api_key=key" + RealtimeNow + "&limit=1000&offset=0&order_by=source_id&sort_order=asc";

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(7, sources.Count());
        }
Пример #2
0
        public void CanGetSources()
        {
            const string response = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<sources realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" order_by=""source_id"" sort_order=""asc"" count=""39"" offset=""0"" limit=""1000"">
  <source id=""1"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Board of Governors of the Federal Reserve System"" link=""http://www.federalreserve.gov/""/>
  <source id=""3"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Reserve Bank of Philadelphia"" link=""http://www.philadelphiafed.org/""/>
  <source id=""4"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Reserve Bank of St. Louis"" link=""http://www.stlouisfed.org/""/>
  <source id=""6"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Federal Financial Institutions Examination Council"" link=""http://www.ffiec.gov/""/>
  <source id=""11"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Dow Jones &amp; Company"" link=""http://www.dowjones.com""/>
  <source id=""13"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Institute for Supply Management"" link=""http://www.ism.ws/""/>
  <source id=""14"" realtime_start=""2012-04-26"" realtime_end=""2012-04-26"" name=""Thomson Reuters/University of Michigan"" link=""https://customers.reuters.com/community/university/default.aspx""/>
</sources>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var sources = fred.GetSources();
            var expectedUrl = "http://api.stlouisfed.org/fred/sources?api_key=key" + RealtimeNow + "&limit=1000&offset=0&order_by=source_id&sort_order=asc";
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(7, sources.Count());
        }