Exemplo n.º 1
0
        public void CanGetACategory()
        {
            const string response = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<categories>
<category id=""1"" name=""Production &amp; Business Activity"" parent_id=""0""/>
</categories>";
            var downloader = new MockDownloader(response);
            var fred = new Fred("key", downloader);
            var category = fred.GetCategory(1);
            const string expectedUrl = "http://api.stlouisfed.org/fred/category?api_key=key&category_id=1";
            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(1, category.Id);
            Assert.AreEqual("Production & Business Activity", category.Name);
            Assert.AreEqual(0, category.ParentId);
        }
Exemplo n.º 2
0
        public void CanGetACategory()
        {
            const string response    = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<categories>
<category id=""1"" name=""Production &amp; Business Activity"" parent_id=""0""/>
</categories>";
            var          downloader  = new MockDownloader(response);
            var          fred        = new Fred("key", downloader);
            var          category    = fred.GetCategory(1);
            const string expectedUrl = "http://api.stlouisfed.org/fred/category?api_key=key&category_id=1";

            Assert.AreEqual(expectedUrl, downloader.Url);
            Assert.AreEqual(1, category.Id);
            Assert.AreEqual("Production & Business Activity", category.Name);
            Assert.AreEqual(0, category.ParentId);
        }