Exemplo n.º 1
0
        public void CanGetCategoryChildren()
        {
            const string response = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<categories>
  <category id=""32262"" name=""Business Cycle Expansions &amp; Contractions"" parent_id=""1""/>
  <category id=""32436"" name=""Construction"" parent_id=""1""/>
  <category id=""32216"" name=""Health Insurance"" parent_id=""1""/>
  <category id=""97"" name=""Housing"" parent_id=""1""/>
  <category id=""3"" name=""Industrial Production &amp; Capacity Utilization"" parent_id=""1""/>
  <category id=""32295"" name=""Institute for Supply Management Report on Business"" parent_id=""1""/>
  <category id=""32429"" name=""Manufacturing"" parent_id=""1""/>
  <category id=""32993"" name=""Motor Vehicles"" parent_id=""1""/>
  <category id=""6"" name=""Retail Sales"" parent_id=""1""/>
</categories>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var categories = fred.GetCategoryChildern(1);
            string expectedUrl =
                "http://api.stlouisfed.org/fred/category/children?api_key=key&category_id=1" + RealtimeNow;
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(9, categories.Count());
        }
Exemplo n.º 2
0
        public void CanGetCategoryChildren()
        {
            const string response    = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<categories>
  <category id=""32262"" name=""Business Cycle Expansions &amp; Contractions"" parent_id=""1""/>
  <category id=""32436"" name=""Construction"" parent_id=""1""/>
  <category id=""32216"" name=""Health Insurance"" parent_id=""1""/>
  <category id=""97"" name=""Housing"" parent_id=""1""/>
  <category id=""3"" name=""Industrial Production &amp; Capacity Utilization"" parent_id=""1""/>
  <category id=""32295"" name=""Institute for Supply Management Report on Business"" parent_id=""1""/>
  <category id=""32429"" name=""Manufacturing"" parent_id=""1""/>
  <category id=""32993"" name=""Motor Vehicles"" parent_id=""1""/>
  <category id=""6"" name=""Retail Sales"" parent_id=""1""/>
</categories>";
            var          downloader  = new MockDownloader(response);
            var          fred        = new Fred("key", downloader);
            var          categories  = fred.GetCategoryChildern(1);
            string       expectedUrl =
                "http://api.stlouisfed.org/fred/category/children?api_key=key&category_id=1" + RealtimeNow;

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(9, categories.Count());
        }